0

我正在使用 TbButtonColumn 来呈现一些图标按钮。我想渲染文本而不是图标。这可能吗?我将如何更改以下代码来做到这一点?

        $gridColumns = array(
        array('name'=>'nick_name', 'header'=>'Interests Sets'),
        array(
            'htmlOptions' => array('nowrap'=>'nowrap'),
            'class'=>'bootstrap.widgets.TbButtonColumn',
            'template'=>'{add} {view}',
            'buttons'=>array(           
                'add' => array
                (
                    'label'=>'See this friend\'s list',
                    'icon'=>'plus',
                    'url'=>'Yii::app()->createUrl("itemList/viewlist", array("friend_id"=>$data->id))',
                    'options'=>array(
                        'class'=>'btn btn-small',
                    ),
                ),
                'view' => array(
                    'label'=>'Search under this friend\'s interesrs',
                    'url'=>'Yii::app()->createUrl("friend/filter", array("friend_id"=>$data->id))',
                        'options'=>array(
                        'class'=>'btn btn-small',
                        ),
                ), 

            ),
        )
    );
4

2 回答 2

2

我对 yii-booster 一无所知,但如果它是 Yii 的 CButtonColumn 之类的东西,您只需将 imageUrl 设置为 false。像这样:

'view' => array(
    'imageUrl'=>false,  // Setting an empty string does not work in vanilla Yii.
    'label'=>'Search under this friend\'s interesrs',
    'url'=>'Yii::app()->createUrl("friend/filter", array("friend_id"=>$data->id))',
        'options'=>array(
            'class'=>'btn btn-small',
        ),
), 
于 2013-05-28T07:46:12.380 回答
0
$gridColumns = array(
    ...
        'buttons'=>array(           
            'add' => array
            (
                'label'=>'text instead of the icons' . 'See this friend\'s list',                    
                'url'=>'Yii::app()->createUrl("itemList/viewlist", array("friend_id"=>$data->id))',
                'options'=>array(
                    'class'=>'btn btn-small',
                ),
            ),

        ),
    )
);

如果你设置 'icon'=>'ololo',运行以下代码:

if (isset($this->icon))
    {
        if (strpos($this->icon, 'icon') === false)
            $this->icon = 'icon-'.implode(' icon-', explode(' ', $this->icon));

        $this->label = '<i class="'.$this->icon.'"></i> '.$this->label;
    }
于 2013-05-28T07:45:57.347 回答