开发者

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
  ),
));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜