??xml version="1.0" encoding="utf-8" standalone="yes"?>精品日本一线二线三线不卡,欧美午夜精品久久久久久人妖 ,欧美国产视频在线观看http://www.aygfsteel.com/redhatlinux/category/35463.html业精于勤荒于?行成于思毁于随 Spring,SpringSecurity,Quartz,Hibernate,Strutszh-cnWed, 11 Feb 2009 16:18:34 GMTWed, 11 Feb 2009 16:18:34 GMT60【{载】解x关Ext Grid导出Excel在JSP{环境中不可用的问题http://www.aygfsteel.com/redhatlinux/archive/2009/02/11/254236.htmlHibernatingHibernatingWed, 11 Feb 2009 05:31:00 GMThttp://www.aygfsteel.com/redhatlinux/archive/2009/02/11/254236.htmlhttp://www.aygfsteel.com/redhatlinux/comments/254236.htmlhttp://www.aygfsteel.com/redhatlinux/archive/2009/02/11/254236.html#Feedback0http://www.aygfsteel.com/redhatlinux/comments/commentRss/254236.htmlhttp://www.aygfsteel.com/redhatlinux/services/trackbacks/254236.html                                         解决有关Ext Grid导出Excel在JSP{环境中不可用的问题
        有关ExtGrid导出Excel的实现方式,|上已经有很多,官方也给Z一个方案,代码不是很完善,不过已经有高人对q个q行了修正。具体实现方式及代码我这里就不再多说了,大家可以参看Q?br /> http://www.dojochina.com/index.php?q=node/1254Q附ӞgridToExcel.js.txt
其基本思想是:客户端根据Grid数据生成Excel格式的XML数据Q然后发送到一个服务端文gQ服务端文g?br /> q设定Content-Type来实现Excel的下载。其?#8220;导出Excel”按钮点击执行的代码如下:

 1if (Ext.isIE6 || Ext.isIE7 || Ext.isSafari || Ext.isSafari2 || Ext.isSafari3) 
 2    if (! Ext.fly('frmDummy')) 
 3        var frm = document.createElement('form'); 
 4        frm.id = 'frmDummy'; 
 5        frm.name = id; 
 6        frm.className = 'x-hidden'; 
 7        document.body.appendChild(frm); 
 8    }
 
 9    Ext.Ajax.request(
10        url: '/exportexcel.php', 
11        method: 'POST', 
12        form: Ext.fly('frmDummy'), 
13        callback: function(o, s, r) 
14            //alert(r.responseText); 
15        }

16        isUpload: true
17        params: {exportContent: vExportContent} 
18    }

19}
 else 
20    document.location = 'data:application/vnd.ms-excel;base64,' + Base64.encode(vExportContent); 
21}

例子中服务端使用的PHPQ这D代码在PHP中可能可以很好的工作Q但是如果到了JSP{环境下Q就出现了问
题,导出数据可能是空?br />  问题出在哪里呢?上面q部分代码中的ajax提交其实q不是真正的ajax提交Q因为ajax提交是在后台执行Q因
此不可能实现下蝲Q可以看到这里有form和isUpload两个参数QExt的ajaxh中如果配|了isUpload:trueQ则?br /> ajax׃是真正的ajaxhQ而是通过创徏一个隐藏的IframeQƈ通过form的target指向q个iframe来提交数据,q?br /> 且发送的header里将content-type设ؓ了multipart/formQ在JSP中不能成功导出的原因在q里。这L提交方式
其参数通过request.getParameter是取不到的,当然你可以用上传组件来获取Q但q样代码变得复杂。下?br /> 来解册个问题,既然q里的Ajax使用是一个模拟的form提交Q那我们其实可以完全不用。我们直接用form?br /> 交不是更省事吗?解决办法如下Q创Z个隐藏formQ其target讄为_blankQ然后在其内部创Z个隐藏域?br /> 放xml数据Q然后通过POST方式提交q个form卛_?/p>

实现代码Q?/p>

 1var vExportContent = grid.getExcelXml(); 
 2if (Ext.isIE6 || Ext.isIE7 || Ext.isSafari || Ext.isSafari2 || Ext.isSafari3) 
 3    var fd=Ext.get('frmDummy'); 
 4    if (!fd) 
 5        fd=Ext.DomHelper.append(Ext.getBody(),{tag:'form',method:'post',id:'frmDummy',action:'exportexcel.jsp', target:'_blank',name:'frmDummy',cls:'x-hidden',cn:[ 
 6            {tag:'input',name:'exportContent',id:'exportContent',type:'hidden'} 
 7        ]}
,true); 
 8    }
 
 9    fd.child('#exportContent').set({value:vExportContent}); 
10    fd.dom.submit(); 
11}
 else 
12    document.location = 'data:application/vnd.ms-excel;base64,'+Base64.encode(vExportContent); 
13}

14

JSP代码Q?br />

1<%  
2response.setHeader("Content-Type","application/force-download"); 
3response.setHeader("Content-Type","application/vnd.ms-excel"); 
4response.setHeader("Content-Disposition","attachment;filename=export.xls"); 
5out.print(request.getParameter("exportContent")); 
6%>


 完整代码下蝲Q?a href="/Files/redhatlinux/grid2excel.rar">grid2excel.rar



Hibernating 2009-02-11 13:31 发表评论
]]>
【{载】Ext.get()与Ext.fly()之区?/title><link>http://www.aygfsteel.com/redhatlinux/archive/2009/02/11/254220.html</link><dc:creator>Hibernating</dc:creator><author>Hibernating</author><pubDate>Wed, 11 Feb 2009 03:51:00 GMT</pubDate><guid>http://www.aygfsteel.com/redhatlinux/archive/2009/02/11/254220.html</guid><wfw:comment>http://www.aygfsteel.com/redhatlinux/comments/254220.html</wfw:comment><comments>http://www.aygfsteel.com/redhatlinux/archive/2009/02/11/254220.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/redhatlinux/comments/commentRss/254220.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/redhatlinux/services/trackbacks/254220.html</trackback:ping><description><![CDATA[<p align="center"><span style="font-size: 18pt; font-family: 隶书">Ext.get()与Ext.fly()之区?/span><br /> 从一开始接触Extq到有Ext.flyq个函数Q当时觉得这个跟Ext.get没什么区别,加之当时对JS性能相关<br /> 问题认识肤浅Q也一直没有在意其区别Q今日看learning extjs一书,看到了有专门对Ext.fly特别的一处:<br /> </p> <p class="code"><code><strong>This isn't exactly a speed tip, but is more about conserving memory by using something called <br /> a "flyweight" to perform simple tasks, which results in higher speed by not clogging up the <br /> browser's memory</strong><br /> </code></p> <p>大概意思也是Ext.Fly采用flyweight模式使所有fly出来的元素共享内存,可以提高E序执行速度Q减内存占用?br /> </p> <p>        q段话激起了我对q个函数的兴,毕竟q段旉一直在搞JS性能优化相关问题Q对“内存”q个字眼<br /> 非常敏感。大概看了下Ext源码对get和fly实现的部分,然后在网上查看了一些资料,l于对他们之间的异同?br /> 了个比较深入的认识?br /> Ext的官方开发h员给Z如下的解释:<br /> </p> <p class="code"><code><strong>Ext.Element wraps a lot of functionality around DOM element/node, for example functions like hide, show, <br /> all animation stuff, dimensions getting and setting function and a lot more. <br /> <br /> Ext.Element keeps reference to DOM element it is wrapped around in dom property. Once you have an Ext.Element<br />  (e.g. you call Ext.get('some-d') it is an instance of Element class and you can work with it as such. <br /> <br /> Now, imagine that you need to hide 1000 DOM nodes, you call 1000 times Ext.get('some-one-of-<br /> 1000-id').hide() so you create 1000 instances of Element just to call one function: hide. <br /> <br /> Ext.fly is one instance of Ext.Element with "replaceable" DOM node it is wrapped around. <br /> If you call 1000 times Ext.fly('some-one-of-1000-id').hide() you 1000 times replace dom property of one instance of Ext.Element. <br /> <br /> Result: higher performance, lower memory usage. <br /> <br /> You only need to keep in mind that you cannot keep Element returned by Ext.fly for later use as <br /> it's dom will sooner or later gets replaced by another one.<br /> </strong></code></p> <p><strong>q段话中Q大致的意思如下:<br /> </strong></p> <p>Ext.Element是Ext对Dom元素的一个强有力装Q它装了很多方便对dom操作的接?q过Element的dom属?br /> 引用对应的dom元素)Q因此每创徏一个Element元素都将消耗不的内存(主要是大量的操作接口消?Q因此如<br /> 果创多的Element元素必然D内存占用的剧增和pȝ性能的下降?br /> </p> <p>Ext.get和Ext.flyq回的都是一个Element对象Q但是Ext.getq回的是一个独立的ElementQ拥有自q立的操作接口<br /> 装Q可以将其返回g存到变量中,以便以后调用操作{,q样为重用带来了方便。但是它的一个很大缺<br /> 点就是内存消耗问题,假如调用Ext.get(id)1000ơ,则会在内存中创徏1000个独立ElementQ其内存占用可想?br /> 知。但是很多时候我们可能仅仅只是对该dom元素执行一ơ很单的操作Q如隐藏(hide)Q这样如果每ơ都创徏<br /> 一个独立Element攑֜内存中,实在是对内存的巨大浪费,因此当我们在只需要执行一ơ操作或者一个很?br /> 的操作时Q采用Ext.get显得很不合理。Ext.fly正是Z解决q个问题而出玎ͼ它通过使每ơ创建的Element?br /> 享内存中的一套操作接口来辑ֈ节省内存的效果?/p> <p><strong>下面来看Ext.fly的实C?我简单加了一些注?Q?br /> </strong></p> <pre jquery1234322781687="5"> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><span style="color: #008080"> 1</span><img id="Codehighlighter1_22_23_Open_Image" onclick="this.style.display='none'; Codehighlighter1_22_23_Open_Text.style.display='none'; Codehighlighter1_22_23_Closed_Image.style.display='inline'; Codehighlighter1_22_23_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_22_23_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_22_23_Closed_Text.style.display='none'; Codehighlighter1_22_23_Open_Image.style.display='inline'; Codehighlighter1_22_23_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span style="color: #0000ff">var</span><span style="color: #000000"> flyFn </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">function</span><span style="color: #000000">()</span><span id="Codehighlighter1_22_23_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_22_23_Open_Text"><span style="color: #000000">{}</span></span><span style="color: #000000">; <br /> </span><span style="color: #008080"> 2</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />flyFn.prototype </span><span style="color: #000000">=</span><span style="color: #000000"> El.prototype; <br /> </span><span style="color: #008080"> 3</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">var</span><span style="color: #000000"> _cls </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> flyFn(); </span><span style="color: #008000">//</span><span style="color: #008000">Element的所有操作接口放在_cls?nbsp;</span><span style="color: #008000"><br /> </span><span style="color: #008080"> 4</span><span style="color: #008000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #000000"> <br /> </span><span style="color: #008080"> 5</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #008000">//</span><span style="color: #008000"> dom is optional </span><span style="color: #008000"><br /> </span><span style="color: #008080"> 6</span><span style="color: #008000"><img id="Codehighlighter1_160_184_Open_Image" onclick="this.style.display='none'; Codehighlighter1_160_184_Open_Text.style.display='none'; Codehighlighter1_160_184_Closed_Image.style.display='inline'; Codehighlighter1_160_184_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_160_184_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_160_184_Closed_Text.style.display='none'; Codehighlighter1_160_184_Open_Image.style.display='inline'; Codehighlighter1_160_184_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="color: #000000">El.Flyweight </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">function</span><span style="color: #000000">(dom)</span><span id="Codehighlighter1_160_184_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_160_184_Open_Text"><span style="color: #000000">{ <br /> </span><span style="color: #008080"> 7</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="color: #0000ff">this</span><span style="color: #000000">.dom </span><span style="color: #000000">=</span><span style="color: #000000"> dom; <br /> </span><span style="color: #008080"> 8</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="color: #000000">; </span><span style="color: #008000">//</span><span style="color: #008000">仅包含一个dom属性的Object </span><span style="color: #008000"><br /> </span><span style="color: #008080"> 9</span><span style="color: #008000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #000000"> <br /> </span><span style="color: #008080">10</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />El.Flyweight.prototype </span><span style="color: #000000">=</span><span style="color: #000000"> _cls; </span><span style="color: #008000">//</span><span style="color: #008000">操作接口复制给Element实例对象 </span><span style="color: #008000"><br /> </span><span style="color: #008080">11</span><span style="color: #008000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #000000">El.Flyweight.prototype.isFlyweight </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">true</span><span style="color: #000000">; </span><span style="color: #008000">//</span><span style="color: #008000">标志该Element是flyweight对象 </span><span style="color: #008000"><br /> </span><span style="color: #008080">12</span><span style="color: #008000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #000000"> <br /> </span><span style="color: #008080">13</span><span style="color: #000000"><img id="Codehighlighter1_352_353_Open_Image" onclick="this.style.display='none'; Codehighlighter1_352_353_Open_Text.style.display='none'; Codehighlighter1_352_353_Closed_Image.style.display='inline'; Codehighlighter1_352_353_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_352_353_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_352_353_Closed_Text.style.display='none'; Codehighlighter1_352_353_Open_Image.style.display='inline'; Codehighlighter1_352_353_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />El._flyweights </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span id="Codehighlighter1_352_353_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_352_353_Open_Text"><span style="color: #000000">{}</span></span><span style="color: #000000">; </span><span style="color: #008000">//</span><span style="color: #008000">flyweight对象~存容器 </span><span style="color: #008000"><br /> </span><span style="color: #008080">14</span><span style="color: #008000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #000000"> <br /> </span><span style="color: #008080">15</span><span style="color: #000000"><img id="Codehighlighter1_405_747_Open_Image" onclick="this.style.display='none'; Codehighlighter1_405_747_Open_Text.style.display='none'; Codehighlighter1_405_747_Closed_Image.style.display='inline'; Codehighlighter1_405_747_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_405_747_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_405_747_Closed_Text.style.display='none'; Codehighlighter1_405_747_Open_Image.style.display='inline'; Codehighlighter1_405_747_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />El.fly </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">function</span><span style="color: #000000">(el, named)</span><span id="Codehighlighter1_405_747_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_405_747_Open_Text"><span style="color: #000000">{ <br /> </span><span style="color: #008080">16</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    named </span><span style="color: #000000">=</span><span style="color: #000000"> named </span><span style="color: #000000">||</span><span style="color: #000000"> '_global'; <br /> </span><span style="color: #008080">17</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    el </span><span style="color: #000000">=</span><span style="color: #000000"> Ext.getDom(el); </span><span style="color: #008000">//</span><span style="color: #008000">取得dom对象 </span><span style="color: #008000"><br /> </span><span style="color: #008080">18</span><span style="color: #008000"><img id="Codehighlighter1_488_517_Open_Image" onclick="this.style.display='none'; Codehighlighter1_488_517_Open_Text.style.display='none'; Codehighlighter1_488_517_Closed_Image.style.display='inline'; Codehighlighter1_488_517_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_488_517_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_488_517_Closed_Text.style.display='none'; Codehighlighter1_488_517_Open_Image.style.display='inline'; Codehighlighter1_488_517_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span style="color: #000000">    </span><span style="color: #0000ff">if</span><span style="color: #000000">(</span><span style="color: #000000">!</span><span style="color: #000000">el)</span><span id="Codehighlighter1_488_517_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_488_517_Open_Text"><span style="color: #000000">{ <br /> </span><span style="color: #008080">19</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #0000ff">null</span><span style="color: #000000">; <br /> </span><span style="color: #008080">20</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="color: #000000"> <br /> </span><span style="color: #008080">21</span><span style="color: #000000"><img id="Codehighlighter1_550_646_Open_Image" onclick="this.style.display='none'; Codehighlighter1_550_646_Open_Text.style.display='none'; Codehighlighter1_550_646_Closed_Image.style.display='inline'; Codehighlighter1_550_646_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_550_646_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_550_646_Closed_Text.style.display='none'; Codehighlighter1_550_646_Open_Image.style.display='inline'; Codehighlighter1_550_646_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="color: #0000ff">if</span><span style="color: #000000">(</span><span style="color: #000000">!</span><span style="color: #000000">El._flyweights[named])</span><span id="Codehighlighter1_550_646_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_550_646_Open_Text"><span style="color: #000000">{ <br /> </span><span style="color: #008080">22</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />        El._flyweights[named] </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> El.Flyweight(); </span><span style="color: #008000">//</span><span style="color: #008000">仅在W一ơ调用Ext.fly时创Z个Flyweight对象q缓?nbsp;</span><span style="color: #008000"><br /> </span><span style="color: #008080">23</span><span style="color: #008000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /></span><span style="color: #000000">    }</span></span><span style="color: #000000"> <br /> </span><span style="color: #008080">24</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    El._flyweights[named].dom </span><span style="color: #000000">=</span><span style="color: #000000"> el; </span><span style="color: #008000">//</span><span style="color: #008000">flyweight对象的dom属性指向该el </span><span style="color: #008000"><br /> </span><span style="color: #008080">25</span><span style="color: #008000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">    </span><span style="color: #0000ff">return</span><span style="color: #000000"> El._flyweights[named]; <br /> </span><span style="color: #008080">26</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="color: #000000">;</span></div> <br /> 从上面的代码不难看出Q仅在第一ơ调用Ext.fly时创Z个Flyweight对象Q该对象包含了Element的所有操作接口)q将其缓存,</pre> <p>之后的所有fly操作都只是修改该flyweight对象的dom属性,每次flyq回的结果都是共享的同一个flyweight对象?br /> q样每次flyq回的Element相比Ext.get而言Q减了每次创徏Element时对大量的操作接口的创徏。所有fly的对?br /> 都共享一套Element操作接口Q内存占用自然少了很多,而且执行速度也得C提升。在大量的创建操作中?br /> 果会更加明显?/p> <p>׃fly的操作原理,我们不能fly的返回结果保存在变量中以侉K用,因ؓ每次fly操作都将可能改变该变量的<br /> dom指向。如下面的代码就是不正确的:<br /> </p> <pre jquery1234322781687="11"> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><span style="color: #008080">1</span><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: #0000ff">var</span><span style="color: #000000"> my_id </span><span style="color: #000000">=</span><span style="color: #000000"> Ext.fly('my_id');    <br /> </span><span style="color: #008080">2</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />Ext.fly('another_id'); </span><span style="color: #008000">//</span><span style="color: #008000">此时my_id的dom引用已经变ؓanother_id    </span><span style="color: #008000"><br /> </span><span style="color: #008080">3</span><span style="color: #008000"><img id="Codehighlighter1_116_192_Open_Image" onclick="this.style.display='none'; Codehighlighter1_116_192_Open_Text.style.display='none'; Codehighlighter1_116_192_Closed_Image.style.display='inline'; Codehighlighter1_116_192_Closed_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_116_192_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_116_192_Closed_Text.style.display='none'; Codehighlighter1_116_192_Open_Image.style.display='inline'; Codehighlighter1_116_192_Open_Text.style.display='inline';" alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="color: #000000">my_id.highlight('FF0000',</span><span id="Codehighlighter1_116_192_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_116_192_Open_Text"><span style="color: #000000">{ </span><span style="color: #008000">//</span><span style="color: #008000">此处的操作将是对  another_id元素的操?nbsp;      </span><span style="color: #008000"><br /> </span><span style="color: #008080">4</span><span style="color: #008000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">    endColor:'0000FF', duration: </span><span style="color: #000000">3</span><span style="color: #000000">    <br /> </span><span style="color: #008080">5</span><span style="color: #000000"><img alt="" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="color: #000000">);</span></div> </pre> <p>在以后用中Q一定要合理的利用Ext.get和Ext.flyQ避免滥用Ext.getq个“重量U?#8221;的方法?br /> <br /> 转自Qhttp://www.ajaxbbs.net/post/extjs/Ext-fly-and-Ext-get.html</p><img src ="http://www.aygfsteel.com/redhatlinux/aggbug/254220.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/redhatlinux/" target="_blank">Hibernating</a> 2009-02-11 11:51 <a href="http://www.aygfsteel.com/redhatlinux/archive/2009/02/11/254220.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ExtJs2.x开发环?-Eclipse、Adobe Dreamweaver安装和配|ExtJs2.x开发插?/title><link>http://www.aygfsteel.com/redhatlinux/archive/2008/10/27/236809.html</link><dc:creator>Hibernating</dc:creator><author>Hibernating</author><pubDate>Mon, 27 Oct 2008 03:08:00 GMT</pubDate><guid>http://www.aygfsteel.com/redhatlinux/archive/2008/10/27/236809.html</guid><wfw:comment>http://www.aygfsteel.com/redhatlinux/comments/236809.html</wfw:comment><comments>http://www.aygfsteel.com/redhatlinux/archive/2008/10/27/236809.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.aygfsteel.com/redhatlinux/comments/commentRss/236809.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/redhatlinux/services/trackbacks/236809.html</trackback:ping><description><![CDATA[     摘要: Spket是目前支持Ext 2.0最为出色的IDE?它采?jsb project file 文gq将l承于基cd所有文档的内容嵌入到生成代码提C的Script doc中。虽然有比较好用的开发插Ӟ但是我个人徏议和我一L初学者还是应该采用手写代码的方式d习ExtJsQ这样便于更好的掌握和理解ExtJs。毕竟工兯是ؓ了项目的快速开发而设计的Q学习就应该一步一个脚印?nbsp; <a href='http://www.aygfsteel.com/redhatlinux/archive/2008/10/27/236809.html'>阅读全文</a><img src ="http://www.aygfsteel.com/redhatlinux/aggbug/236809.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/redhatlinux/" target="_blank">Hibernating</a> 2008-10-27 11:08 <a href="http://www.aygfsteel.com/redhatlinux/archive/2008/10/27/236809.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【个人收藏】几个用ExtJs构徏的应用演C?更新?...)http://www.aygfsteel.com/redhatlinux/archive/2008/10/24/236384.htmlHibernatingHibernatingFri, 24 Oct 2008 05:20:00 GMThttp://www.aygfsteel.com/redhatlinux/archive/2008/10/24/236384.htmlhttp://www.aygfsteel.com/redhatlinux/comments/236384.htmlhttp://www.aygfsteel.com/redhatlinux/archive/2008/10/24/236384.html#Feedback2http://www.aygfsteel.com/redhatlinux/comments/commentRss/236384.htmlhttp://www.aygfsteel.com/redhatlinux/services/trackbacks/236384.html阅读全文

Hibernating 2008-10-24 13:20 发表评论
]]>
【个人收藏】ExtJs2.2视频教程在线观看及下?/title><link>http://www.aygfsteel.com/redhatlinux/archive/2008/10/24/236354.html</link><dc:creator>Hibernating</dc:creator><author>Hibernating</author><pubDate>Fri, 24 Oct 2008 03:19:00 GMT</pubDate><guid>http://www.aygfsteel.com/redhatlinux/archive/2008/10/24/236354.html</guid><wfw:comment>http://www.aygfsteel.com/redhatlinux/comments/236354.html</wfw:comment><comments>http://www.aygfsteel.com/redhatlinux/archive/2008/10/24/236354.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/redhatlinux/comments/commentRss/236354.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/redhatlinux/services/trackbacks/236354.html</trackback:ping><description><![CDATA[     摘要: ExtJs2.2视频教程在线观看及下载,由DOJO中国 | E序员联盟亲情打造,正在学习?感觉很不错,讲得非常l,也让我对ExtJs有了新的认识Q感谢DOJOCHINA,感谢陈治文老师  <a href='http://www.aygfsteel.com/redhatlinux/archive/2008/10/24/236354.html'>阅读全文</a><img src ="http://www.aygfsteel.com/redhatlinux/aggbug/236354.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/redhatlinux/" target="_blank">Hibernating</a> 2008-10-24 11:19 <a href="http://www.aygfsteel.com/redhatlinux/archive/2008/10/24/236354.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ұ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank">ֶ</a>| <a href="http://" target="_blank">Ȫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ӻ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">㶫ʡ</a>| <a href="http://" target="_blank">ϽϽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ȫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ױ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">կ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">żҽ</a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">ݳ</a>| <a href="http://" target="_blank">׶</a>| <a href="http://" target="_blank">˶</a>| <a href="http://" target="_blank">˫</a>| <a href="http://" target="_blank">ϳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">¡</a>| <a href="http://" target="_blank">»</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ˮ</a>| <a href="http://" target="_blank">տ</a>| <a href="http://" target="_blank"></a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>