1. #1
    Ext User
    Join Date
    Sep 2008
    Posts
    13
    Vote Rating
    0
    aromero is on a distinguished road

      0  

    Default Group sorting in Grid w/ grouping

    Group sorting in Grid w/ grouping


    Hi, I have a Grid with grouping and I need to sort the groups with another criteria different from the default (for example, if you are using a string field to group records, the default sort is the alphabetical order).

    Lets put an example using the demo here http://gwt-ext.com/demo/#gridGrouping
    Grouping here is done using the 'industry' field, so groups are sorted using the alphabetical order of the industry (first Automotive, then Computer, etc...). What I need to do is to sort these groups under some other criteria, for example the number of records inside each group. Using this strategy groups would be listed as Automotive (1 record), then Food (2 records), .... last Manufacturing (9 records).

    Is there any way to achieve this? The sorting function depends on some info inside the groups.

  2. #2
    Ext User
    Join Date
    Jul 2009
    Posts
    25
    Vote Rating
    0
    silv is on a distinguished road

      0  

    Default


    I am actually having the same problem. I would like to sort on a field other than the grouping field. It looks like it always sorts on the grouping field in ascending order. Haven't quite figured out how to stop this.

  3. #3
    Ext User
    Join Date
    Jul 2009
    Posts
    25
    Vote Rating
    0
    silv is on a distinguished road

      0  

    Default


    Found this thread which seems to have the answer to the issue. http://extjs.com/forum/showthread.php?t=71495

  4. #4
    Ext User
    Join Date
    Oct 2008
    Posts
    127
    Vote Rating
    0
    wp.joju is on a distinguished road

      0  

    Default


    i am having a problem with this one, the grid sorting works fine on default sort but if i try to sort it with other fields (by clicking on the grid header), the grouping sometimes gets messed up, items that should be in the same group are being divided into 2 or more groups with the same name, please help

  5. #5
    Sencha User
    Join Date
    Sep 2009
    Posts
    11
    Vote Rating
    0
    abbnet is on a distinguished road

      0  

    Default


    A short example of code may help you :

    Code:
    GroupingStore<ModelData> store = (GroupingStore<ModelData>) grid.getStore();
    store.setStoreSorter(new StoreSorter<ModelData>() {
        @Override
        public int compare(Store<ModelData> store, ModelData m1, ModelData m2, String property) {
            return ModelDataUtils.COMPARATOR.compare(m1, m2);
        }
    });
    
    /*
    with 
    ModelData : your data
    grid : your grid
    ModelDataUtils.COMPARATOR : your comparator
    */

  6. #6
    Sencha User
    Join Date
    Apr 2012
    Posts
    12
    Vote Rating
    0
    deepfriedbrain is on a distinguished road

      0  

    Default


    It seemsGroupingStore has been removed from 3x. So, how can we achieve sorting on columns other than the one it's grouped by?

  7. #7
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,634
    Vote Rating
    79
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    We removed that in 3.x in favor of supporting more than one comparison at a time. The 3.x Store classes allow multiple StoreSortInfo objects to be added - where you used to group by one property then sort by another, now you just sort by one, then the other.

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