i want to filter index page by user regency iput thsi code in my controller


		$user= User::model()->findByAttributes(array('id' => $user_id));

//		var_dump($user->regency_id);

//		die();


		$criteria = new CDbCriteria();

		$criteria->condition = 'lksaData.regency_id=regency_id';

		$criteria->params = array('lksaData.regency_id'=>$user_reg);


		//$lksaDataHeader = LksaDataHeader::model()->findAll($criteria);

		$dataProvider= new CActiveDataProvider($this, array(


		//$dataProvider=new CActiveDataProvider('LksaDataHeader');



but i got this error

Fatal error: Call to a member function getDbCriteria() on a non-object in C:\xampp\htdocs\lksa_kemensos\framework\web\CActiveDataProvider.php on line 173

any mistakes in my code?and how to solve it :( thx before

$dataProvider= new CActiveDataProvider($this, array(


you should use a model as data provider first argument, not the controller ($this)

thanks gustavo for your help but when i change to $model i got this error Undefined variable: model how can i declare $model?

In your case the model is $user.

thx kokomo,yeah it works now :D