I have an ongoing project. It is currently live and works using SEF URLs with the following config:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
...
),
),
I am currently attempting to implement some admin functions, one of which is management of keywords to which the CGridView widget seems perfectly matched. So, I have created an action in my admin controller:
public function actionKeywords()
{
$dataProvider = new CActiveDataProvider('Keyword');
$model = new Keyword();
$this->render('keywords', array('model'=>$model,'dataProvider'=>$dataProvider));
}
and the matching view:
$this->widget('zii.widgets.grid.CGridView',array(
'dataProvider'=>$dataProvider,
'filter'=>$model,
'columns'=>array(
'id',
'keyword',
'description',
'type_id',
'create_time',
'ignored',
),
));
I realise the filter will not really work yet as I am not assigning the $model->search() function as the dataProvider, however that raises a separate issue so I’ll deal with that later.
Whenever I enter a value in the filter fields, the table is updated with an ajax request like:
http://mydomain.com/admin/keywords?Keyword[id]=&Keyword[keyword]=&Keyword[synonym]=&Keyword[description]=&Keyword[type_id]=&Keyword[create_time]=&Keyword[ignored]=1&ajax=yw0
It seems that these GET variables are not being read by the Yii application, as adding a trace to the action like so:
Yii::trace("GET PARAMS: ".print_r($_GET,true));
shows up in Firebug with
[10:14:22.457][trace][application] GET PARAMS: Array ( )
Am I missing something? I know I can edit jquery.yiiGridView.js to use POST instead of GET, but I’d rather not edit core framework. I thought Yii was supposed to handle get queries in the URL; or is it something with my rewrite?