1. #1
    Ext GWT Premium Member
    Join Date
    Feb 2010
    Location
    Cracow, Poland
    Posts
    15
    Vote Rating
    0
    lhanusiak is on a distinguished road

      0  

    Default Sorting BeanModel grid

    Sorting BeanModel grid


    In my project I created a BeanModel grid as it was shown in GXT Showcase http://www.sencha.com/examples/#beanmodelgrid

    but when I set default sort [store.setDefaultSort(field, SortDir)] field I was unpleasantly surprised because loaded data was unsorted and previously set sorting info was gone.

    In my opinion problem is caused by following code:
    Code:
    public class ListStore<M extends ModelData> extends Store<M> {
     ...
         @SuppressWarnings("unchecked")
         protected void onLoad(LoadEvent le) {
            ...
            if (le.<Object> getConfig() instanceof ListLoadConfig) {
             ListLoadConfig config = le.getConfig();
             if (!Util.isEmptyString(config.getSortInfo().getSortField())) {
              sortInfo = config.getSortInfo();
             } else {
              sortInfo = new SortInfo();
             }
            }
            ...
         }
     ...
    }
    Is there any simple way to deal with this problem and sort data in BeanModel grid after loading it via proxy??

  2. #2
    Sencha User
    Join Date
    Jan 2010
    Posts
    43
    Vote Rating
    0
    blackbox23 is on a distinguished road

      0  

    Default


    You can do your sorting in the server.

    On BeforeLoad prepare your load config object. Set the sort info like sort field and sort dir.

    When you get hold of the data in the server, sort it using comparator, using the info from the load config before you send the data back to the client. Look at the GXT source. There;s an example there on how remote sorting is done.

  3. #3
    Ext GWT Premium Member
    Join Date
    Feb 2010
    Location
    Cracow, Poland
    Posts
    15
    Vote Rating
    0
    lhanusiak is on a distinguished road

      0  

    Default


    Of course I can do this on server and in fact on many occasions I prefer remote sorting.
    I currently find out that using
    Code:
    grid.getStore().setStoreSorter(new StoreSorter<BeanModel>(StoreSorter.DEFAULT_COMPARATOR));
    loader.setSortField("lastname");
    loader.setSortDir(SortDir.ASC);
    loader.setReuseLoadConfig(true);
    forces grid to sort data locally. But I really want to know why method onLoad overwrites already set sortInfo with empty configuration. Simple null check should do the trick or am I wrong?

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Hello,

    yes there should probably be a check, but this would be a braking change. I target 2.3 and 3.0 for this.

  5. #5
    Ext GWT Premium Member
    Join Date
    Feb 2010
    Location
    Cracow, Poland
    Posts
    15
    Vote Rating
    0
    lhanusiak is on a distinguished road

      0  

    Default


    Thank you for satisfying my curiosity.

Similar Threads

  1. Once do sorting in a grid, how to disable sorting then?
    By rosemondi in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 8 Apr 2010, 9:04 AM
  2. Once do sorting for a grid, then how to disable sorting?
    By rosemondi in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 7 Apr 2010, 7:32 PM
  3. BeanModel / Grid
    By rernst in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 23 Oct 2009, 10:49 AM
  4. Buffered BeanModel Grid?
    By rlaferla in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 12 Aug 2009, 1:27 AM
  5. BeanModel Grid
    By aurelie in forum Ext GWT: Discussion
    Replies: 4
    Last Post: 5 Aug 2009, 11:04 PM

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar