View Full Version : Finding records of similar type

31 Aug 2012, 7:54 AM

I have an ExtJS 4.0.7 Store that is populated with json to show in a grid.
One field in every record defines its group.
How do i count out the records belonging to same group and name of different groups.
I do not want to use grouping feature as it causes various sorting issues.

Thanks in advance

31 Aug 2012, 9:29 AM
You can filter the store to count unique values ..

Just update code to add counter.

Ext.create('Ext.Button', {
text: 'Filter Me',
renderTo: Ext.getBody(),
handler: function() {
var uniqueValue = '';
store.filter( // filter unique names
filterFn: function(item) {
var name = item.get('name');
if (uniqueValue !== name) {
uniqueValue = name;
return true;
} return false;