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

有帮助吗?

解决方案

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.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top