Hi,
I’m trying to sort a CgridView, based on specific model PK, but when I click the sort links the last search criteria disappears. Seems that there is a param enableHistory to do so, but it doesn’t works in my case, continues fetching the whole model …
this is how it looks my code …
View:
$model->Id = 666;
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>$id,
'ajaxUrl' => Yii::app()->createUrl("/Mycontroller/admin/",array(
'id'=>$model->Id,
'edit'=>$edit
)
),
'enableHistory' => true,
'dataProvider'=>$model->search(),
'template'=>'{items}{pager}',
'columns'=>$columns,
)
);
Model:
public function search()
{
...
$criteria->compare('Id',$this->Id);
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,
'pagination'=>array(
'route'=> "Mycontroller/admin"
),
'sort'=>array(
'route'=> '/Mycontroller/admin',
)
));
}
if it can be accomplished by remembering the filters I know how, but would be very great if I can customize the first ajax or overwrite the cgridview js update call in order to send always the desired parameters. I only can do it refreshing the cgridview when the document is ready, but it’s not a good approach because that’s two calls…