<div class="codetitle"> <span><a style="CURSOR: pointer" data="8828" class="copybut" id="copybut8828" onclick="doCopy('code8828')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code8828"> <br><script type="text/javascript"> <BR>Ext. data.Store.prototype.applySort=function(){//重載applySort <BR>if(this.sortInfo && !this.remoteSort){ <BR>var s = this.sortInfo, f=s.field; <🎜🎜>var s = this.sortInfo, f=s.field; <🎜🎜>var s = this.sortInfo, f=s.field; <🎜🎜>var s = this.sortInfo, f=s.field; <🎜🎜>var s = this.sortInfo, f=s.field; <🎜🎜 >var st=this.fields.get(f).sortType; <BR>var fn=function(r1,r2){ <BR>var v1=st(r1.data[f]),v2=st(r2. data[f]); <BR>//新增:修正漢字排序異常的Bug <BR>if(typeof(v1)=="string"){//若為字串<BR>return v1.localeCompare(v2 );//則localeCompare比較漢字字串,Firefox與IE皆支援<BR>}//新增結束<BR>return v1>v2 ? 1 : (v1<v2 ? -1 : 0); <BR>}; <BR>this.data.sort(s.direction,fn); <BR>if(this.snapshot && this.snapshot!=this.data){ <BR>this.snapshot.sort(s.direction,fn) ; <BR>} <BR>} <BR>}; <BR></script> <br><br> </div>