Question

I have a problem with Yii search, which is working fine when accessing the page(Students/admin) directly, but if i renderPartial the same page from another page(Students/reg), Yii filter not search the result..

Thanks in advance

Was it helpful?

Solution

You have to create the model manually in your actionReg of the StudentsController. These values of the model will be used by the CGridView to set the filter.

This might be something like this:

public function actionReg($id) {
  $model = Students::model();
  $model->attributes = $_GET['Students'];

  $this->render('reg', array(
           'model' => $model,
        ));
}

If you have custom values in the model you have to set them also, for example

  $model->calculatedAverage = $_GET['Students']['calculatedAverage'];

Then in your RegView you can pass this model to the table.

To get an idea of how this works, try understanding what happens in the adminAction method.

OTHER TIPS

If I'm getting this right, renderPartial doesn't process inline js if you don't use it properly. Try doing:

$this->renderPartial('view',array(...),false,true);

It should help. The last argument (true), tells Yii to process output.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top