ListGrid Grouping

Hi,

I’m working with the ListGrid and have 3 requirements (or questions):

  1. At the time of initialization of the grid, I set the group start open to “all”. When the grid loads, all the groups are in “expanded” mode, as expected. However, later based upon a particular action, I change the “groupby” field inside an action handler. After the change, all the groups go back to “collapsed” mode. I want to show all the groups in the “expanded” mode again. I tried to use the following immediately after the “groupby” call, but it doesn’t work:
mainGrid.groupBy("process-group");
mainGrid.setGroupStartOpen(GroupStartOpen.ALL);

How do I control the expand/collapse function of the groups?

  1. How do I get the current field by which the rows are grouped?

  2. For the Header Context Menu’s “Group by <field>” action, which action handler should I use? Again this is needed to expand the groups after the “Group By” field is changed by the user. Currently, all the groups collapse when a user changes the “Group By” field (manually). I have noticed the same behavior in the showcase sample:

http://www.smartclient.com/smartgwt/showcase/#grid_grouping_dynamic

I’m using Smart GWT 2.2 and GWT 2.0.4.

Thanks for your help.

I was able to manipulate what was open by getting the grid’s group tree and calling functions on it:

				Tree groupTree = grid.getGroupTree();
				groupTree.openAll();

groupTree.openAll(); worked only if i use setData. Not after using dataSource and fetchData().

Can you please let us know the solution for this?

fetchData() is asynchronous, use the callback.