i am newbie to yii and i have question about using CListView with CDataActiveProvider with CDbCriteria.
I am using the same index/controller as the yiic create, and i added criteria to the CDataActiveProvider.
The correct list appears in the first render(with the right count number), but when i move to the next page it seems that it ignores my condition and retrieves the whole table without the condition.
The controller code:
public function actionIndex()
{
$criteria=new CDbCriteria ();
if (isset($_POST['Manufacturers']['Id']))
{
$manId =$_POST['Manufacturers']['Id'];
$criteria->compare('ManufacturerId',$manId);
}
$dataProvider=new CActiveDataProvider('Models', array(
'criteria'=>$criteria));
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
the index code:
<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_view',