Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Exand & Collapse Groups in ListGrid

    Hey,

    I'm trying to create an event click listener to expand and collapse all the groups in a grouped listgrid. I couldn't figure out a way to implement it. Is it achievable, if yes, can someone please guide me on the implementation?

    GWT:1.5.3
    SmartGWT: 2.2

    Thanks,

    Kuan

    #2
    You want to know how to expand all or collapse all groups? Or you want to intercept the expansion/collapse event itself?

    Comment


      #3
      Hey Svjard,

      I want to know how to expand or collapse all groups and intercept the event as well.

      Thanks,

      Comment


        #4
        Code:
        ListGrid.getGroupTree().closeAll();
        ListGrid.getGroupTree().openAll();
        Intercepting is a little bit trickier, if you add a click handler and then do a check like:
        Code:
        if (event.getRecord().getAttribute("groupValue") != null) {
           This is a group header cell
        }
        Note that doesn't intercept the programmatic opening and closing, just when a user explicity opens or closes a group.

        Comment


          #5
          oh I didn't notice there is a method to get the group tree object. Thank you very much!

          There is another issue that I have encountered. After the data is been grouped, when I apply filter criteria from filter builder, the data didn't get filtered accordingly. Do I need to ungroup first and filter then group it again?
          Last edited by KHH; 27 May 2010, 12:29.

          Comment


            #6
            Filtering works on a grouped grid. Post some minimal code of what your doing.

            Comment


              #7
              Hey Svjard,

              ListGrid code:

              Code:
              ListGrid testListGrid = new ListGrid();
              testListGrid .setDataSource(DSStore.testDS);  
              testListGrid .setAutoFetchData(false);    
              testListGrid .setGroupByMaxRecords(20000);
              testListGrid .setScrollRedrawDelay(500);
              testListGrid .setHoverWidth(200);
              testListGrid .setOverflow(Overflow.AUTO);      
              
              testListGrid.setFields(fields...);
              Datasource code:
              Code:
              DataSource instance = new DataSource();
              setID(id);  
              setTitleField("account");  
              setRecordXPath("items");  
              setDataFormat(DSDataFormat.JSON);  
              	        
              Define fields......
              
              setFields(fields.....);   
              	
              setDataURL("getList.do");  
              setClientOnly(false);
              Advanced Filter Builder
              Code:
               FilterBuilder fb = new FilterBuilder();
              
              (Inside of GWTEXT button click listener)
              AdvancedCriteria ac = fb.getCriteria();
              testListGrid .filterData(ac);
              It seems like after the filterData is been called, it's going to the server side and fetch the whole data again.

              Also, I'm using GWTEXT 1.5.3. I'm not sure if this will effect anything.

              Thanks for your help.
              Last edited by KHH; 27 May 2010, 14:01.

              Comment


                #8
                any help please?

                Comment

                Working...
                X