PDA

View Full Version : GroupingView: Unable to toggle first group. view.getGroups() length is 0



karthik_br
31 Jan 2011, 11:11 PM
Hello,

I have a GroupingView and I am trying have just the first group expanded and rest remain collapsed (startCollapsed: true). The issue is that getGroups() is of size 0. I tried this code in both 'viewready' event listener of the groupingView and after dolayout for grid panel container.



var view = propGrid.getView();
var groups = view.getGroups();
if(groups.length)
this.toggleGroup(groups[0], true);


I have tried to use deferRowRender:false based on this forum thread but of no use.
http://www.sencha.com/forum/showthread.php?87722-GroupingView-and-toggleGroup&highlight=getGroupId

view.toggleRowIndex(0, true); dosent work either (:|

Please advise...

Regards,
Karthik

Condor
1 Feb 2011, 12:14 AM
You only should use the 'viewready' event if the store is already loaded by the time the grid is rendered.

Use the store 'load' event when the store loads after the grid is rendered.

karthik_br
1 Feb 2011, 11:01 AM
Thanks Condor.....that did the trick....'load' worked for me.


listeners : {
'load' : function(store, records, options){
var view = Ext.getCmp('prop_grid').getView();
var groups = view.getGroups();
if(groups.length)
view.toggleGroup(groups[0], true);
}
}