打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Extjs grid中文排序异常修正
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]);

            
// 添加:修复汉字排序异常的Bug

            
if (typeof(v1) == "string") { // 若为字符串,

                
// 则用 localeCompare 比较汉字字符串, Firefox 与IE 均支持
                return v1.localeCompare(v2);

            }

            
// 添加结束

            
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);

        }

    }

};
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
异步封装API(回调函数应用)
前端面试题整理——作用域和闭包
QCameraStateMachine
jquery.unobtrusive-ajax.js源码阅读
浅谈Bootstrap插件机制
js 数组 map方法
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服