\", \"value3\"." />
开发者

Disable html rendering in combobox dropdown list

开发者 https://www.devze.com 2022-12-18 04:02 出处:网络
With ExtJs 3.1 My Ext.form.ComboBox is built with a store in which some values are like this : \"value1\", \"<value2>\", \"value3\".

With ExtJs 3.1

My Ext.form.ComboBox is built with a store in which some values are like this : "value1", "<value2>", "value3". The开发者_StackOverflow中文版 problem is that "<value2>" is interpreted as a HTML tag when the combobox dropdown list is displayed. And i don't want that. Any idea?


Specify a custom template for the ComboBox list and pass the values through the HTML encoding filter:

new Ext.form.ComboBox({
    store: new Ext.data.ArrayStore({
        fields: ['field_name'],
        data: [['<item1>']]
    }),
    displayField: 'field_name',
    valueField: 'field_name',
    mode: 'local',
    tpl: '<tpl for=".">'
        +'<div class="x-combo-list-item">'
        +'{field_name:htmlEncode}'
        +'</div>'
        +'</tpl>'
});


Try escaping the values before binding.

0

精彩评论

暂无评论...
验证码 换一张
取 消