0

我有一个使用 Csqldataprovider 的 gridview 但不像 CAtiveDataProvider 默认 cButton 列没有出现我确实向它编写了自定义代码

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

),

也没有在 gridview 中渲染 $data["mid"]

但浏览器呈现

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

谁能告诉我我错过了什么

4

2 回答 2

0

尝试这样的事情

array(
            'class'=>'CButtonColumn',
                    'buttons'=>array(
                        'delete'=>array(
                            'url'=>  'your/ url',
                        ),
                        'update'=>array(
                            'url'=> 'your/ url',
                        ),
                        'view'=>array(
                            'url'=>'your/ url',
                        ),
                    ),
        ),
于 2014-01-22T07:19:57.187 回答
-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"]))',
),
于 2014-05-22T10:16:29.107 回答