1. // 重载 Ext.data.Store.prototype.applySort 函数以修复 DataStore 对汉字排序异常的问题
2.
3. // var _applySort = Ext.data.Store.prototype.applySort;
4.
5. //如有需要,保存原 applySort 函数的引用
6.
7. function(){ //重载 applySort
8.
9. if(this.sortInfo && !this.remoteSort){ //sortInfo对象存在并且不是远程排序
10.
11. var s = this.sortInfo, f = s.field;
12.
13. var st = this.fields.get(f).sortType;
14.
15. var fn = function(r1, r2){
16.
17. var
18.
19. // 添加:修复汉字排序异常的Bug
20.
21. if(typeof(v1) == "string"){ //若为字符串类型,
22. //则用 localeCompare 比较汉字字符串, Firefox 与 IE 均支持
23. return
24. }
25.
26. //若不是字符串类型
27. return
28.
29. };
30.
31. this.data.sort(s.direction, fn);
32.
33. if(this.snapshot && this.snapshot != this.data){ //数据快照
34.
35. this.snapshot.sort(s.direction, fn);
36.
37. }
38.
39. }
40.
41. };
EXT 中文排序问题
原创foamflower ©著作权
©著作权归作者所有:来自51CTO博客作者foamflower的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:多线程设计要点
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
排序算法之计数排序的优化
排序算法之计数排序的优化
数组 计数排序 最小值 -
【C】排序算法
文章介绍了几种常用的排序,包括其实现思路与具体代码实现。
排序 算法 代码分析 -
PostgreSQl无法中文排序问题
PostgreSQl无法安装中文排序问题
Linux 中文 PostgreSQL 排序 字符