欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Extjs Gird 支持中文拼音排序?qū)崿F(xiàn)代碼

 更新時(shí)間:2013年04月15日 11:18:26   作者:  
本文為大家詳細(xì)介紹下Extjs Gird 支持中文拼音排序以及修復(fù)漢字排序異常的Bug、localeCompare比較漢字字符串,F(xiàn)irefox與IE均支持,感興趣的朋友可以參考下
復(fù)制代碼 代碼如下:

<script type="text/javascript">
Ext.data.Store.prototype.applySort=function(){//重載applySort
if(this.sortInfo && !this.remoteSort){
var s = this.sortInfo, f=s.field;
var st=this.fields.get(f).sortType;
var fn=function(r1,r2){
var v1=st(r1.data[f]),v2=st(r2.data[f]);
//添加:修復(fù)漢字排序異常的Bug
if(typeof(v1)=="string"){//若為字符串
return v1.localeCompare(v2);//則localeCompare比較漢字字符串,F(xiàn)irefox與IE均支持
}//添加結(jié)束
return v1>v2 ? 1 : (v1<v2 ? -1 : 0);
};
this.data.sort(s.direction,fn);
if(this.snapshot && this.snapshot!=this.data){
this.snapshot.sort(s.direction,fn);
}
}
};
</script>

相關(guān)文章

最新評(píng)論