我正在使用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',
),
),
),
)
);
答案 0 :(得分: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',
),
),
答案 1 :(得分: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;
}