Yii CListView: url get-params redefining
Using the sorting and pagination in ClistView we have urls like:
controller/action?Model_page=NUM&Model_sort=COL.
Is it possible to make urls look like
controller/action?page=NUM&so开发者_JS百科rt=COL.
and if it is possible, how can i make it?
Yes, you can set these parameters when you create your CActiveDataProvider:
$myDataProvider = new CActiveDataProvider('MyModel', array(
'sort'=>array(
'defaultOrder'=>'id DESC',
'sortVar'=>'sort' // set the sort parameter
),
'pagination'=>array(
'pageSize'=>5,
'pageVar'=>'page' // and and page param here
),
));
精彩评论