kavih7
19 Nov 2009, 6:58 PM
So, last night I needed a way to get the number of items in a group from a grouping store/view. I initially did a query on the store to get the number of items per group and that worked, but I wanted to reuse any previous code from the GroupingView/GroupingStore classes and add a new method to the GroupingStore class. So I did:
Ext.override(Ext.data.GroupingStore, {
getGroupCount: function(groupId)
{
var group = Ext.getDom(groupId);
if (group != null)
{
return group.childNodes[1].childNodes.length;
}
return 0;
}
});
However, after writing it and trying to use it, I realized it was nice having the query results, because I also had the records within the group and could do what I wanted with them. Basically, what I'm trying to say is here's my override if you want to use it, even though I didn't... :D
Ext.override(Ext.data.GroupingStore, {
getGroupCount: function(groupId)
{
var group = Ext.getDom(groupId);
if (group != null)
{
return group.childNodes[1].childNodes.length;
}
return 0;
}
});
However, after writing it and trying to use it, I realized it was nice having the query results, because I also had the records within the group and could do what I wanted with them. Basically, what I'm trying to say is here's my override if you want to use it, even though I didn't... :D