sali1
(Yiiframework Rde)
December 16, 2012, 10:08am
1
Hi,
I have a gridview widget:
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider' => $model->search(),
'summaryText' => 'صفحه {page} از مجموع {pages} صفحه',
'enableSorting' => false,
'enablePagination' => true,
'ajaxUpdate' => false,
'columns'=>array(
//....
),
));
In the pagination links it includes the model name as prefix to pageVar parameter. is there anyway to set the pageVar property of widget so it changes the links from "index.php?r=item/list&Items_page=2 " to "index.php?r=item/list&page=2 " ?
Cheers,
Yaser
seenivasan
(Chellamnivas)
December 16, 2012, 2:27pm
2
Dear Yaser
We have to set the pageVar property in dataProvider .
One example.
In Model
public function search()
{
$criteria=new CDbCriteria;
$criteria->compare('id',$this->id);
$criteria->compare('name',$this->name,true);
$criteria->compare('rank',$this->rank);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'sort'=>array(
'attributes'=>array('id','name','score','rank')
),
'pagination'=>array('pageVar'=>'page'),//as aproperty of CPagination
));
}
Regards
sali1
(Yiiframework Rde)
December 16, 2012, 2:47pm
3
Thanks for the answer
It’s exaxtly what I was looking for