How To Set The "pagevar" Parameter For The Grid View Widget?

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

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

Thanks for the answer

It’s exaxtly what I was looking for :)