问题
I am using ExtJs (4.2) I am facing an Issue that my XTemplate is not working with IE when it contains functions.
Anyone can help.
回答1:
I was not getting more help on this topic then I dig into it and found that apply function is not working perfectly for IE.
xTemplate = new Ext.XTemplate(me.getTemplate(), {
getCompanyDescriptionHTML: me.getCompanyDescriptionHTML
});
xTemplate.apply(data));
What apply method do, it compiles the template and bind data in. I further investigated it and found that apply itself is not a problematic. It is function within my template and IE is unable to handle the values passed to the function.
getTemplate: function () {
var tpl = "<tpl>";
tpl += "<div>";
tpl += "{[this.getCompanyDescriptionHTML({values})]}";
tpl += "</div>";
}
I tried many tricks and finally replacing function parameter values with values:values solved my problem.
"{[this.getCompanyDescriptionHTML({values:values})]}"
The good thing is, the same worked for Chrome as well :)
来源:https://stackoverflow.com/questions/42301039/extjs-xtemplate-is-not-working-with-ie-when-it-contains-functions