<ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="CompanyX" /> <script type="text/javascript"> Ext.override(Ext.data.Store, { applySort: function () { if (this.sortInfo && !this.remoteSort) { var s = this.sortInfo; var f = s.field; var st = this.fields.get(f).sortType; var fn = function (r1, r2) { var v1 = st(r1.data[f]); var v2 = st(r2.data[f]); if (typeof (v1) == "string") { 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); } } } }); </script>
Ext.Net 默认排序方式不符合我们的习惯,如日期会将1月10排在1月2日前面,数字也是如此,重载排序即可