Dataprovider: Change Condition Afterwards


i asked a simillar question some days ago. Now im able to isoloate my problem more exact.

I use a grid view together with a searching row on the head of the table. I use the "search"-Method of the model to initalize my "dataProvider" in the controller:

$dataProvider = $model->search();

After this i want to add some more condtion to the provider. I thought i have to simpliy add some more conditions to the "criteria->condition" of the dataProvider. I tryed to access the contions in the view like the following:


$criteria = new CDbCriteria;

$criteria = $dataProvider->criteria;

echo $criteria->condition;


But no information is return from the echo. I would be pleased if someone can give me an advice how i can add condtions to the provider.

Hi Yerok,

You’d better consider making use of or customizing “search” method to satisfy your needs.

You could pass the additional searching conditions to it.