No setSortField() method for ListStore, loss of functionality from GXT 2.x
Version(s) of Ext GWT
GXT 3.0.1 GPL
Browser versions and OS (and desktop environment, if applicable)
In GXT 2.x there was the ability to set what the initial sort state of the store for a grid was to match the presorting of the list. For example, if the list was pre-sorted by name asc you could tell the store that was the case so you would not have to initailly click on the column header twice to get a sort desc since the first click would trigger a sort asc which the list was already sorted as such.
Steps to reproduce the problem
Create a liststore with models that have a name string field
Sort the liststore by the name field asc
add the store to a grid with a name column
click on the name column header - nothing happens
click on the name column header again - the list is now sorted desc
The first click would result in the correct sort of being opposite of the current sort sate i.e. if sorted asc would be desc now.
Must click twice on column header instead of once.
* Entry point classes define <code>onModuleLoad()</code>.
public class GXTSandBox implements EntryPoint
* This is the entry point method.
public void onModuleLoad ()
ListStore<Person> store = new ListStore<Person>(PersonProperties.INSTANCE.key());
Thanks - this is indeed a missing piece of functionality, and while it does require an additional click from the user, it is still possible to achieve the same effect. I've filed this internally, and we'll post any updates or workarounds as they become available.
That said, the functionality loss is not in the ListStore, but in the Grid/GridView. The ListStore is only responsible for sorting as instructed - as sorting is more flexible than in 2.x, it won't always be possible to display the sort behavior in grid headers. Instead, the Grid or GridView should have a way to tell it which sort to start with programmatically, to get the UI to update accordingly.
We've made a change in SVN that should fix this issue - if there is a sort object in the store that matches one of the existing columns, that column should now be decorated with the sort indicator. This fix is now in the latest nightly builds, and will be present in the next release.