1. #1
    Sencha User
    Join Date
    Mar 2010
    Location
    Colorado, USA
    Posts
    8
    Vote Rating
    0
    danpres14 is on a distinguished road

      0  

    Question GroupingStore - How many groups exist based on the current grouping and sorting?

    GroupingStore - How many groups exist based on the current grouping and sorting?


    I would like to either collapse or expand each group based on the number of groups and the number of rows in each group. I have found the methods to expand or collapse all groups, however, I can't seem to figure out how to determine how many groups exist or a way to iterate through the groups and ask each group for how many rows exist within that group. I am trying to do this inside of the 'load' listener - maybe there is a better place to put this code?

    Any help or examples would be very much appreciated!

    Thanks,
    -Dan

  2. #2
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,713
    Vote Rating
    104
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      0  

    Default


    That doesn't seem to be built in, however you could try these overrides:

    Code:
    Ext.override(Ext.data.GroupingStore, {
        getGroupNames : function() {
            return this.collect(this.groupField);
        },
        getNumberOfGroups : function() {
            return this.getGroupNames().length;
        },
        getRecordsInGroup : function (group) {
            return this.queryBy(function(r) {
                return r.get(this.groupField) === group;
            }, this);
        }
    });

Similar Threads

  1. Replies: 2
    Last Post: 16 May 2011, 10:03 PM
  2. How do I loop thru groupingstore for groups only
    By moegal in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 27 Apr 2010, 5:38 PM
  3. Don't Want Groups Sorted in GroupingStore
    By annRT in forum Ext 3.x: Help & Discussion
    Replies: 8
    Last Post: 8 Sep 2009, 3:45 PM
  4. [resolved]GroupingStore - how to hide grouping grouping field?
    By taiti in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 22 May 2008, 12:23 AM
  5. GroupingStore - how to sort groups by a different column?
    By Jim McCabe in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 14 Oct 2007, 3:57 AM

Thread Participants: 1

Tags for this Thread