PDA

View Full Version : How to do multiple grouping in grid?



galvanchi
28 Jan 2014, 12:41 AM
I have an ASP.NET MVC project with client side logic based on ExtJs 4. I need to do Double filter grouping, but I dont know how. I'm new in extJs. All what I imagine is in follow example, but I need to group this fields by year and then inside the year it must be grouped by topic. Can anybody help me?

Ext.define('Book', {
extend: 'Ext.data.Model',
fields: ['name', 'topic', 'year']
});
var Books = Ext.create('Ext.data.Store', {
model: 'Book',
groupField: 'topic',
data: [{
name: 'Learning Ext JS',
topic: 'Ext JS',
year: 2012
},{
name: 'Learning Ext JS 3.2',
topic: 'Ext JS',
year: 2012
}{
name: 'NHibernate 3.0 Cookbook',
topic: '.NET',
year: 2012
},{
name: 'ASP.NET MVC 2 Cookbook',
topic: '.NET',
year: 2013
}]
});
Ext.create('Ext.grid.Panel', {
renderTo: Ext.getBody(),
frame: true,
store: Books,
width: 350,
height: 400,
title: 'Books',
features: [Ext.create('Ext.grid.feature.Grouping',{
groupHeaderTpl: 'topic: {name} ({rows.length}
Book{[values.rows.length > 1 ? "s" : ""]})'
})],
columns: [{
text: 'Name',
flex: 1,
dataIndex: 'name'
},{
text: 'Topic',
flex: 1,
dataIndex: 'topic'
}]
});

scottmartin
28 Jan 2014, 12:41 PM
You can visit our plugins forum and in the search bar, enter 'multigrouping'
http://www.sencha.com/forum/forumdisplay.php?82-Ext-User-Extensions-and-Plugins

galvanchi
28 Jan 2014, 12:49 PM
You can visit our plugins forum and in the search bar, enter 'multigrouping'
http://www.sencha.com/forum/forumdisplay.php?82-Ext-User-Extensions-and-Plugins

Yes I found some plugins, but creators isn't explain how to use there solutions. Just images.