Hello, I have a problem (first sorry for my bad english )
I’ve created a grid: the pagination works perfectly. But the filters do not.
My controller is a module. (module Missive, controller Missive).
public function actionIndex()
{
$model=new Missive('missiveRicevute');
$model->unsetAttributes();
if(isset($_GET['Missive']))
$model->attributes=$_GET['Missive'];
$this->render('index',array(
'model'=>$model,
));
}
public function missiveRicevute()
{
$criteria=new CDbCriteria;
$criteria->compare('mittente_nome',$this->mittente_nome);
$criteria->compare('testo',$this->testo);
$criteria->compare('data', CDateTimeParser::parse($this->data, 'dd/MM/yyyy'));
$criteria->condition = 'destinatario_id = :destinatario';
$criteria->params = array(':destinatario' => Yii::app()->user->id);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'missive-grid',
'dataProvider'=>$model->missiveRicevute(),
'filter'=>$model,
'columns'=>array(
array(
'name' => 'data',
'header' => 'Data',
'value'=> 'CTimestamp::formatDate("d/m/Y", $data->data)'
),
array(
'name' => 'mittente_nome',
'header' => 'Mittente',
),
'testo',
array(
'class'=>'CButtonColumn',
'template'=>'{view}{delete}',
),
),
)); ?>
What’s wrong? I’ve checked the ajax url in firebug when I use the filters but it is ok. I’ve no idea