0

i have got a gridview using the Csqldataprovider but then unlike CAtiveDataProvider default cButton column doesnt appear i did write the custom code to it

array(
 'class'=>'zii.widgets.grid.CButtonColumn',
 'viewButtonUrl'=>'Yii::app()->createUrl("/Controllername/view",array("id"=>$data["mid"]))',

),

as well am not rendering $data["mid"] in the gridview

but yet browser renders

PHP notice Trying to get property of non-object ...yii\framework\base\CComponent.php(612) : eval()'d code(1)

can anyone tell me what am i missing

Tested
  • 761
  • 4
  • 16
  • 38
  • The "$data" for the grid is an CActiveRecord derived object normally,so unless you added ArrayAccess functionality or did something else special, that won't work to start with. – Blizz Jan 22 '14 at 07:27

2 Answers2

0

try something like this

array(
            'class'=>'CButtonColumn',
                    'buttons'=>array(
                        'delete'=>array(
                            'url'=>  'your/ url',
                        ),
                        'update'=>array(
                            'url'=> 'your/ url',
                        ),
                        'view'=>array(
                            'url'=>'your/ url',
                        ),
                    ),
        ),
Let me see
  • 5,063
  • 9
  • 34
  • 47
  • nope not wrkng ...... same error PHP notice Trying to get property of non-object ...yii\framework\base\CComponent.php(612) : eval()'d code(1) – Tested Jan 22 '14 at 07:26
  • i got it 'template'=>'{view}', was missing – Tested Jan 22 '14 at 07:29
-1

try

array('header'=>'Modifies',

'headerHtmlOptions' => array('style' => 'background-color:#E4E7E8'),

'htmlOptions' => array('style' => 'width:55px'),

'class'=>'zii.widgets.grid.CButtonColumn',

'viewButtonUrl'=>'Yii::app()->createUrl("/account/view", array("id"=>$data["id"]))',

'updateButtonUrl'=>'Yii::app()->createUrl("/account/editDealer", array( "d789@_5%1%d" => $data["id"]))',

'deleteButtonUrl'=>'Yii::app()->createUrl("/account/deleteDealer", array("d!7_@371%d"=>$data["id"]))',
),
Our Man in Bananas
  • 5,809
  • 21
  • 91
  • 148