1

我正在使用 Yiibooster 和 TbGridView 来显示一些结果。我还使用以下代码为视图、更新和删除链接提供智能图标。

array(
    'htmlOptions' => array('nowrap'=>'nowrap'),
    'class'=>'bootstrap.widgets.TbButtonColumn',
    'viewButtonUrl'=>'Yii::app()->createUrl("/item/view", array("id"=>$data["id"], "sector" => $data["sector"]["slug"],"title" => $data["slug"]))',
    'updateButtonUrl'=>'Yii::app()->createUrl("/item/update", array("id"=>$data["id"]))',
    'deleteButtonUrl'=>null,
)

我想做的基本上是能够在那里显示另一个按钮或代替删除按钮。我只是不确定我需要如何(或具体在哪里)为这个按钮编码值。

我目前正在查看 TbButtonColumn.php 文件并尝试仅添加一个按钮以查看它是否可以正常工作。

这样做的正确过程是什么?

提前致谢

强尼

4

1 回答 1

2

有一个buttons附加按钮的参数,它在 docs odCButtonColumns中,这是来自链接的示例:

array(
    'class'=>'CButtonColumn',
    // Template to set order of buttons
    'template' => '{postview} {preview}',
    // Buttons config
    'buttons' => array(
        'postview' => array(
            'label' => '...',     // text label of the button
            'url' => '...',       // the PHP expression for generating the URL of the button
            'imageUrl' => '...',  // 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
        ),
        'preview' => array(
            // Another button config
        ),
    ),
),

注意:这是示例,CButtonColumnTbButtonColumn它是 的子类CButtonColumn,因此所有内容都适用于两者。

于 2013-05-24T08:24:27.247 回答