使用TbHtml的TbEdiableColumn中的用法图标

时间:2015-02-10 14:26:01

标签: yii yii-booster

我使用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">&lt;span class=&quot;glyphicon fa fa-usd&quot;&gt;&lt;/span&gt;</option>
<option value="glyphicon fa fa-jpy">&lt;span class=&quot;glyphicon fa fa-jpy&quot;&gt;&lt;/span&gt;</option>
<option value="glyphicon fa fa-eur">&lt;span class=&quot;glyphicon fa fa-eur&quot;&gt;&lt;/span&gt;</option>
<option value="glyphicon fa fa-rub">&lt;span class=&quot;glyphicon fa fa-rub&quot;&gt;&lt;/span&gt;</option>
</select>

有什么想法吗?

1 个答案:

答案 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
            )
        ),

更多信息: http://ybe.demopage.ru/#EditableColumn