Im using CArrayDataProvider for pagination. Now only page numbers are passed in url. I want to pass some more additional attributes. How do I do that? Here is my dataprovider.
$dataProvider = new CArrayDataProvider($arrayData, array(
'keyField'=>'entity_id',
'sort'=>array(
'attributes'=>array('entity_id'),
'defaultOrder'=>array('entity_id' => false),
),
'pagination'=>array(
'pageSize'=>20,
),
));
CPagination takes params. Try adding 'params' => array('foo' => 'bar')
in pagination
.
The question was how to pass "additional" parameters.
The code of the accepted answer will override your existing $_GET parameters:
'params' => array('foo' => 'bar')
To add "additional" parameters, first add them to existing $_GET parameters:
$pagerparams = $_GET;
$pagerparams['foo'] = 'bar';
$dataProvider = new CActiveDataProvider($this, array(
'pagination'=>array(
'params' => $pagerparams,
),
...
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With