Problem With Page Buttons Of Clistview

Hi,

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',		

)); ?>

any idea what am i doing wrong? 





Thanks

[color="#006400"]/* Moved from "Bug Discussions" to "General Discussion for Yii 1.1.x" */[/color]

Dear Friend

I hope the following would be helpful in your case.




public function actionIndex()

{

    $criteria=new CDbCriteria ();


    if (isset($_POST['Manufacturers']['Id']))

    {

        Yii::app()->user->setState('mId',$_POST['Manufacturers']['Id']);

    }


    if(Yii::app()->user->hasState('mId'))

    {

        $criteria->compare('ManufacturerId',Yii::app()->user->getState('mId'));

    }





   $dataProvider=new CActiveDataProvider('Models', array(

         'criteria'=>$criteria));


   $this->render('index',array('dataProvider'=>$dataProvider));

}






Regards.

Yes! great thanks it works.