How to determine if all groups are expanded in GridPanel?

  1. #1

    [CLOSED] How to determine if all groups are expanded in GridPanel?

    I am finalizing the development of a GridPanel and wanted to polish a couple of UI minor issues. We have two buttons "Expand All" and "Collapse All" that are displayed if groups are being shown (view.canGroup()). Is there a way to determine if all groups are currently expanded? If they are then I will disable the "Expand All" button. I know this is somewhat ridiculous and causes extra management, but I wanted to see how easy it is to accomplish.

    I looked at the GroupView.js and followed how toggleGroup works to determine the current state of a group. But I am missing something.

    Any suggestions?
    Last edited by cwolcott; Dec 31, 2011 at 2:29 AM. Reason: Later thread solved issue
  2. #2
    With a can of soda and some candy it didn't take to long to get close to what I want. I just need to add listeners to when groups are expanded or collapsed so I can perform the check again. The basic code segment is:

    var allExpanded = true; allCollapsed = true;
    
    if (view.canGroup() {
       var groups = view.getGroups();
       for (var i = 0; len = groups.length; i < len; i++) {
          var gel = Ext.get(groups[i]);
          var id = Ext.util.Format.htmlEncode(gel.id);
          var rtn = this.state[id];
    
          allExpanded = allExpanded && rtn;
          allCollapsed = allCollapsed && !rtn;
          }
    }
    Like I said I still need to polish a couple of things up but I think I have it.
  3. #3
    Getting late. Time to go home and sleep on this. Is there a way to capture when a group is expanded or collapsed?
  4. #4
    Found a way to catch rows when they are being expanded/collapsed but having issues getting the override to fire.

    Post describing override

    I will try a simple testcase instead of deep inside my code. I placed the overide in the page's HEAD section which is in the master page, but that isn't working. Trying to figure if I can register it during a page load.
    Last edited by cwolcott; Dec 30, 2011 at 12:45 PM.

Similar Threads

  1. Replies: 3
    Last Post: Feb 16, 2012, 4:26 PM
  2. Order GridPanel Groups
    By dany4446 in forum 1.x Help
    Replies: 4
    Last Post: Feb 03, 2012, 1:37 AM
  3. [CLOSED] Expanding / Collapsing all groups of a gridpanel
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 17, 2010, 7:43 PM
  4. Replies: 1
    Last Post: Sep 02, 2010, 3:59 PM
  5. Replies: 8
    Last Post: Apr 06, 2010, 7:20 AM

Tags for this Thread

Posting Permissions