1. #1
    Ext JS Premium Member
    Join Date
    Feb 2010
    Location
    Vancouver, BC
    Posts
    195
    Vote Rating
    0
    rkim is on a distinguished road

      0  

    Default Unanswered: encoding html for checkbox, combobox

    Unanswered: encoding html for checkbox, combobox


    What is the best way to encode html tags such as boxLabel(for checkbox) and displayField(for combobox) in extjs4 ?

    I am doing template for

    Ext.create("Ext.form.Combobox",
    {...
    tpl: new Ext.XTemplate('<tpl for="."><li class="x-boundlist-item" role="option">' + '{[this.encodeHTML(values.name)]}&nbsp;' + '</li></tpl>',
    { encodeHTML: function(val){ return MyEncodeHTMLFunction(val); }})
    ...
    }

    Do you recommend to do something similar for checkbox ?? if yes, how do we do it ??
    or.. is there any recommended way from EXT ?? I don't want to change the server side to create another field.

  2. #2
    Touch Premium Member
    Join Date
    Feb 2011
    Location
    NJ
    Posts
    311
    Vote Rating
    52
    Answers
    59
    droessner is a jewel in the rough droessner is a jewel in the rough droessner is a jewel in the rough

      0  

    Default


    Not sure what else your encode function is doing, but Ext does have an htmlEncode function available.

    See:
    http://docs.sencha.com/ext-js/4-0/#!...hod-htmlEncode

    You could then just use Ext.htmlEncode(values.name)

  3. #3
    Ext JS Premium Member
    Join Date
    Feb 2010
    Location
    Vancouver, BC
    Posts
    195
    Vote Rating
    0
    rkim is on a distinguished road

      0  

    Default


    Thanks for your reply droessner. I do realize the htmlencode function from ext..
    I am more wondered using template is the best option to encode display field in ext4 ? (I saw from other forum in ext3.. using template). also wondered how to do it for checkbox boxLabels.

    Quote Originally Posted by droessner View Post
    Not sure what else your encode function is doing, but Ext does have an htmlEncode function available.

    See:
    http://docs.sencha.com/ext-js/4-0/#!...hod-htmlEncode

    You could then just use Ext.htmlEncode(values.name)

Thread Participants: 1