<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; <BR>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> </div>