PDA

View Full Version : DataStore sorting and grouping remotely



limscoder
31 Jan 2012, 4:16 PM
I'm having trouble getting local sorting and grouping working with a Store.

I expect local sorting and grouping with the following configuration:



this.store = Ext.create('Ext.data.Store', {
autoLoad: false,
remoteGroup: false,
remoteSort: false,
remoteFilter: false,
groupField: this.groupAttribute,
});


However, the sort paramater and group parameter are both added to the Proxy's request parameters when my Ext.data.proxy.Rest object calls it's buildRequest method. What do I need to do to perform the sorting and grouping locally?

skirtle
31 Jan 2012, 7:25 PM
The parameters may be sent to the server but it doesn't mean local sorting isn't working. Several parameters get sent to the server by default, usually it's simplest just to ignore them but if you need to disable them see the docs for the sortParam and groupParam config options.

Do you have any reason to believe that local sorting isn't working? You haven't specified any sorting in the example you provided but I'd expect local grouping (effectively sorting) to be working ok.

limscoder
31 Jan 2012, 7:45 PM
If I configure the store without any sorters or groupers (and remoteSort and remoteGroup == false), and then call the 'group' method (passing in an array of grouper configs) after the 'load' event is fired it does not seem to work. The Store fires a 'groupchange' event, but it doesn't seem like there is any default listener to do the actual sort-by-group logic.

skirtle
31 Jan 2012, 9:21 PM
Groupers get prepended as extra sorters in the store itself, there's no listener as such.

Are you able to post a test case? I use groupers all the time and I haven't noticed the problem you're describing. I would guess that there's a subtle problem with your code but it's difficult to say without seeing it.