I’m using CSqlDataProvider(So I can do joins etc.) instead of CActiveDataProvider for CGridView, but it seems if you use CSqlDataProvider you can’t use ‘$data->’ when referencing values. So if you want to change it will error. (Error=‘Trying to get property of non-object’). Any Ideas?
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'grade-earned-grid-2',
'dataProvider'=>$dataProvider,
'columns'=>array(
'id',
'last_name',
array(
'name'=>'last name',
//'type'=>'raw',
'value'=>'$data->last_name'),),
));
tri
(tri - Tommy Riboe)
October 24, 2011, 9:24pm
2
Welcome to the forum!
For CSqlDataProvider (and CArrayDataProvider) db rows are repesented by arrays instead of objects
'value'=>'$data['last_name'],
/Tommy
banamlehsb
(Handsomeboyhi2007)
November 10, 2011, 4:13pm
3
I try it:
array(
'name'=>'maLoaiGD',
'filter'=>CHtml::listData(LoaiGiaoDich::model()->findAll(), 'maLoaiGD', 'tenLoaiGD'),
'value'=>'LoaiGiaoDich::model()->findByPk($data["maLoaiGD"])->tenLoaiGD',
),
but it causes error: Trying to get property of non-object. (I don’t know how to use $data variable)
who can help me? Please.
Sorry for the late Thank you. Thanks!
tri:
Welcome to the forum!
For CSqlDataProvider (and CArrayDataProvider) db rows are repesented by arrays instead of objects
'value'=>'$data['last_name'],
/Tommy