2014-01-22 52 views
0

我有使用Csqldataprovider一個GridView但隨後不像CAtiveDataProvider默認CButton的列犯規出現,我沒有寫定製代碼,以便它使用Csqldataprovider CGridView和CButtonColumn(Yii框架)不出現

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

), 

以及我不是在GridView呈現$數據[「中期」]

,但尚未瀏覽器呈現

PHP通知 試圖讓非對象 財產...警予\框架\基地\ CComponent.php(612):的eval()'d碼(1

誰能告訴我我失去了什麼

+0

的「$數據」網格是的CActiveRecord派生對象一般,所以除非你加入了ArrayAccess功能或做別的東西特別,這是行不通的開始。 – Blizz

回答

0

嘗試這樣的事情

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

nope not wrkng ......同樣的錯誤PHP通知試圖獲取非對象的屬性... yii \ framework \ base \ CComponent.php(612):eval()'d code(1) – hir

+0

我得到它'模板'=>'{查看}',失蹤 – hir

+0

哦:) :)然後..乾杯:) –

-1

嘗試

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("[email protected]_5%1%d" => $data["id"]))', 

'deleteButtonUrl'=>'Yii::app()->createUrl("/account/deleteDealer", array("[email protected]%d"=>$data["id"]))', 
),