I am using yii-booster(4.0.1) TbGridView(extends CGridView) and need to change the filter variable name in _REQUEST($_POST, $_GET) for filter function. In my grid, I have filter functionality and when I press enter after entering some words in the filter input, an ajax request will sent for server. in this request in $_REQUEST I have:
array
(
'page' => '1'
'wsi_it_model_Asset' => array
(
'user' => 'eghlima'
'createdAt' => ''
'serial' => ''
'brand' => ''
'model' => ''
'assetType' => ''
'assigned' => ''
'location' => ''
'status' => ''
)
)
My question is how can I change wsi_it_model_Asset in the request created by CGridView. I know that I should do it through a parameter in CActiveDataProvider when I am creating the dataProvider but I can not find it.
Thanks in advance.
UPDATE 24 Jan
I found my code from another project, as you can see I can change the key
for sort
and pagination
, I need something look like for filtering key;
return new \CActiveDataProvider($this->applicant, array(
'criteria' => $criteria,
'pagination' => array(
'pageVar' => 'p', // <<<<< pagination var
'pageSize' => 20,
),
'sort' => array(
'sortVar' => 's', // <<<<< sorting var
'defaultOrder' => 't.firstName ASC',
'attributes' => array(
'*'
)
),
));
So for pagination, the request which is posting from client to server will be:
array
(
'p' => '7' // <<<<<< page changed to `p`
'wsi_it_model_Asset' => array
(
'user' => 'eghlima'
'createdAt' => ''
'serial' => ''
'brand' => ''
'model' => ''
'assetType' => ''
'assigned' => ''
'location' => ''
'status' => ''
)
)