Q:

Find number of items in each ExtJs grid group

I am trying to find property which gives me number of items in Each ExtJs grid group so that I can only collapse that group if there are more than one item.  I tried at add watch on grdItems but couldn't get right property which displays correct value. 
var view = Ext.getCmp('Grid').getView();
var groupFeature = view.getFeature('groupSummary');
grdItems = view.getEl().query('.x-grid-group-hd');

if (grdItems.length > 0)
{
    for (i = 0; i < grdItems.length; i++)
    {
    }
}        

When I do this grdItems[i].children.length, it gives "1" for every group even if there are more than 1. 

A:

This can be done using the store, use getGroups():

Returns a collection of readonly sub-collections of your store's
  records with grouping applied.  These sub-collections are maintained
  internally by the collection. 

For example: 
var groups = grid.getStore().getGroups();

groups.each(function(group) {
    console.log(group.getGroupKey(), group.getCount());
});

Working example: https://fiddle.sencha.com/#fiddle/1469

