using Csqldataprovider CGridView and CButtonColumn (Yii Framework) dont appear

585 Views Asked by At

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

2

There are 2 best solutions below

2
Let me see On

try something like this

array(
            'class'=>'CButtonColumn',
                    'buttons'=>array(
                        'delete'=>array(
                            'url'=>  'your/ url',
                        ),
                        'update'=>array(
                            'url'=> 'your/ url',
                        ),
                        'view'=>array(
                            'url'=>'your/ url',
                        ),
                    ),
        ),
0
Puthearith Phuon On

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"]))',
),