开发者

Javascript :- ExtJS el.dom.innerHtml Removed <link> and <style> tags on IE only It works fine Firefox. when el.dom.innerHtml assign html string

For FireFox el.dom.innerHTML

<title>Test</title>
<link rel="stylesheet" type="text/css" href="common.css">

Test

For IE el.dom.innerHTML

Test

In FF the returned el.dom.innerhtml includes the and tag but in IE it does not. Are these filtered out by Ext in anyway and if so why?

Below this forum link give solution to override the Ext.element.Update method.

Ext.override(Ext.Element, {
    update : function(html, loadScripts, callback){
}

http://www.sencha.com/forum/开发者_运维问答showthread.php?30110-internet-explorer-autoLoad-css-not-applied

But I have question where I add this function which ExtJs files. because ext-all-2.2.js and ext-base-2.2 is core files of ExtJs Libarary. I put this code in ExtExtension-2.2.js file but Override Update method doesn't fire when assign this.el.dom.innerHtml=Markup (markup is string which contain html string.)

Please help me which ExtJs file I put function . Ext.Override(Ext.Element) Update Method?


That override simply needs to run sometime after the Ext scripts are loaded. So include a javascript file after including the Ext files, and the method will be overridden.

<script type="text/javascript" src="/path/to/ext-all-2.2.js"></script>
<script type="text/javascript" src="/path/to/myscript.js"></script>

The in myscript.js:

Ext.override(Ext.Element, {
    update : function(html, loadScripts, callback){
        ...
    }
}

Remember though, that Ext isn't magic. It can't automatically fire the update function when simply assigning innerHTML, as that is handled entirely by the browser. Rather, use the update function directly, and that will update the innerHTML:

Instead of:

this.el.dom.innerHtml=Markup;

use:

this.el.update(Markup);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜