S
S
Sergey Melnikov2015-04-29 14:00:40
Yii
Sergey Melnikov, 2015-04-29 14:00:40

How to make zii.widgets.grid.CGridView work?

Greetings.
Tell me, this thing does not work. From the Controller (action update) I pass 2 models to the view:
$model1=Data1::model()->findByPk($id);
$model2 = Data2::model()->findAll('page=:num',array(':num' => $id));
further in update:
<?php $this->renderPartial('_form', array('model1'=>$model1,'model2'=>$model2)); ?>
in view processing:

$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'data1-grid',
    'dataProvider'=>$model1->search(),
    'filter'=>$model1,
    'columns'=>array(
        'idpage',
        'name',
        
        
        
        
        /*
         'status',
'migr_code',
*/
        array(
            'class'=>'CButtonColumn',
        ),
    ),
));

$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'data2-grid',
    'dataProvider'=>$model2->search(),
    'filter'=>$model2,
    'columns'=>array(
        'idpage',
        'name',
        
        
        
        
        /*
         'status',
'migr_code',
*/
        array(
            'class'=>'CButtonColumn',
        ),
    ),
));

Why doesn't data2-grid work so hard?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Grechushnikov, 2015-04-29
@maxyc_webber

look again at the documentation

E
Evgeny Bukharev, 2015-04-29
@evgenybuckharev

$model2 = Data2::model()->findAll('page=:num',array(':num' => $id));
Most likely this function returns an array of objects

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question