mariobros
mariobros

Reputation: 899

Yii CGridView multiple dataProvider

It's possible put two o more parameters to the "dataProvider" attribute in CGridView? Example:

$dataProvider=new CActiveDataProvider('Gallery', array(
'criteria'=>array(
    'condition'=>'type=1',
),));

$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'gallery-grid',
    'dataProvider' => array($dataProvider, $model->search()),
    'filter' => $model));

I want to put $dataProvider and $model->search() in the same filter, it is possible?

Upvotes: 0

Views: 1582

Answers (1)

rinat.io
rinat.io

Reputation: 3188

I guess no, but you can probably use another way:

$dataProvider = $model->search();
$dataProvider->criteria->addCondition('type=1');
$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'gallery-grid',
    'dataProvider' => $dataProvider,
    'filter' => $model
));

Upvotes: 2

Related Questions