看了API手册的代码实例,感觉应该这样写:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'category-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',//其中的一个字段
'level',//其中的一个字段
'name',//其中的一个字段
array(//这个数组尝试添加自定义的按钮
'class'=>'CButtonColumn',
'buttons'=>array(
'upbutton' => array(
'label'=>'up', // text label of the button
'url'=>array("category/index"), // a PHP expression for generating the URL of the button
'imageUrl'=>false, // image URL of the button. If not set or false, a text link is used
'options'=>array(), // HTML options for the button tag
'click'=>'', // a JS function to be invoked when the button is clicked
'visible'=>'' // a PHP expression for determining whether the button is visible
)
),
'template'=>'{view}{update}{delete}{upbutton}',
)
)));
尝试很多次,都不成功。有做过这个功能的吗,请提供一个具体的例子。谢谢。