PDA

View Full Version : Remotely multi sort a store



eztam
25 Aug 2010, 11:25 PM
Hi,

I've got an Ext.data.DirectStore for a GridPanel, which has a PagingToolbar. So If I want to add multiSort it has to be remotely sorted because the store contains only the records of the actual view. I looked for the paramNames variable for multiSort and couldn't find one. Then I looked into the multiSort function of Ext.data.Store and found this:

if (this.remoteSort) {
this.singleSort(sorters[0].field, sorters[0].direction);
}

This means that remoteSort automatically uses singleSort!?

I don't want to extend the DirectStore, so my idea is to create a beforeload listener:


var store = new Ext.data.DirectStore({
...
listeners: {
beforeload: function(store, options) {
options.params.sorters = store.multiSortInfo.sorters;
}
},
paramOrder: "start|limit|sorters"
...
});

Is it a proper way to handle this?
Do you have other suggestions?



Thanks eztam!