[英]ExtJS 4 remoteSort asDate
For my remote-sort i use in ExtJS 3 the keyword asDate which was sent in direction-part of request: 对于我的远程排序,我在ExtJS 3中使用了关键字asDate ,它是在请求的指示部分发送的:
sort:my_date
dir:asDate ASC
In ExtJS 4 i miss the sortType information in Request: 在ExtJS 4中,我错过了Request中的sortType信息:
sort:[{"property":"my_date","direction":"DESC"}]
is there any way to get the sortType information on server side? 有什么办法可以在服务器端获取sortType信息?
You can the override encodeSorters function. 您可以覆盖encodeSorters函数。 I'll make you an example :) 我给你一个例子:)
http://jsfiddle.net/Vandeplas/xLz5C/1/ http://jsfiddle.net/Vandeplas/xLz5C/1/
var store = Ext.create('Ext.data.Store', {
model: 'User',
sorters: [{
property: 'age',
direction: 'DESC',
sortType: 'asDate'
}, {
property: 'firstName',
direction: 'ASC'
}],
proxy: {
type: 'ajax',
url: '/echo/json/',
reader: {
type: 'json',
root: 'users'
},
encodeSorters: function (sorters) {
var min = [],
length = sorters.length,
i = 0;
for (; i < length; i++) {
min[i] = {
property: sorters[i].property,
direction: sorters[i].direction,
sortType: sorters[i].sortType
};
}
return this.applyEncoding(min);
}
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.