In Statement In Gridview

I’ve got a gridview, but I want to limit the results based on the Id.

Normally I’d do something like:


But supplying an array like below doesn’t work as it expects a string, not an array;

$model=new Item('search');

$model->unsetAttributes();  // clear any default values



$model->id = array(1,2,3,4);

Is there a way I can do this?

please show your Item::search()-code

however, have a look at

try this on model searh function


Ah thanks, I solved it by doing this.

public function search()


		// Warning: Please modify the following code to remove attributes that

		// should not be searched.

		$criteria=new CDbCriteria;


		if ($this->scenario === 'workset')


			$set = $this->getWorkSet();

			$criteria->addInCondition('id', $set);



		//More compare items

		return $this->relatedSearch(