Answer the question
In order to leave comments, you need to log in
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',
),
),
));
Answer the question
In order to leave comments, you need to log in
$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 questionAsk a Question
731 491 924 answers to any question