我使用TbGridView和类TbEditableColumn编辑元素TbGridView一次,但我有一个问题 - TbEditableColumn的值不能与字体真棒图标。如何使字体真棒的TbEditableColumn值?
示例:
array(
'class' => 'booster.widgets.TbEditableColumn',
'name' => 'pictogram',
'sortable' => true,
'editable' => array(
'url' => $this->createUrl('/currencyAjax/update'),
'placement' => 'right',
'inputclass' => 'span3',
'title' => 'Currency',
'type' => 'select',
'source' => Currency::getPictograms(),
)
),
和Currency :: getPictograms()这样:
public static $currencyPictograms = array(
'glyphicon fa fa-usd' => '<span class="glyphicon fa fa-usd"></span>',
'glyphicon fa fa-jpy' => '<span class="glyphicon fa fa-jpy"></span>',
'glyphicon fa fa-eur' => '<span class="glyphicon fa fa-eur"></span>',
'glyphicon fa fa-rub' => '<span class="glyphicon fa fa-rub"></span>',
);
public static function getPictograms(){
return self::$currencyPictograms;
}
结果我有:
<select class="form-control span3">
<option value="glyphicon fa fa-usd"><span class="glyphicon fa fa-usd"></span></option>
<option value="glyphicon fa fa-jpy"><span class="glyphicon fa fa-jpy"></span></option>
<option value="glyphicon fa fa-eur"><span class="glyphicon fa fa-eur"></span></option>
<option value="glyphicon fa fa-rub"><span class="glyphicon fa fa-rub"></span></option>
</select>
有什么想法吗?
答案 0 :(得分:0)
array(
'class' => 'booster.widgets.TbEditableColumn',
'name' => 'pictogram',
'sortable' => true,
'editable' => array(
'url' => $this->createUrl('/currencyAjax/update'),
'placement' => 'right',
'inputclass' => 'span3',
'title' => 'Currency',
'type' => 'select',
'source' => Currency::getPictograms(),
'encode' => false, // <= this flag should turn off html encoding
)
),