PDA

View Full Version : collapsing/expading all the values of grid grouping store



sbodanapu
18 Jul 2012, 4:16 AM
HI friends,
I am working on the task of expanding/collapsing all the values of grid grouping store.
i.e if i click on ' Expand All ' button, all the store values (grouping values) being displayed in the grid have to be expanded..
same as with the ' Collapse All ' button..

Please suggest me any possible way.

Thanks for reading this.

Regards,
Sandeep

redraid
18 Jul 2012, 4:37 AM
Grouping feature have methods collapseAll, expandAll:


var store = Ext.create('Ext.data.Store', {
storeId:'employeeStore',
fields:['name', 'seniority', 'department'],
groupField: 'department',
data: {'employees':[
{ "name": "Michael Scott", "seniority": 7, "department": "Management" },
{ "name": "Dwight Schrute", "seniority": 2, "department": "Sales" },
{ "name": "Jim Halpert", "seniority": 3, "department": "Sales" },
{ "name": "Kevin Malone", "seniority": 4, "department": "Accounting" },
{ "name": "Angela Martin", "seniority": 5, "department": "Accounting" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'employees'
}
}
});
var grouping = Ext.create('Ext.grid.feature.Grouping');
Ext.create('Ext.grid.Panel', {
title: 'Employees',
store: Ext.data.StoreManager.lookup('employeeStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Seniority', dataIndex: 'seniority' }
],
features: [grouping],
width: 200,
height: 275,
renderTo: Ext.getBody(),
tbar: [{
text: 'collapse all',
handler: function (btn) {
grouping.collapseAll();
}
},{
text: 'expand all',
handler: function (btn) {
grouping.expandAll();
}
}]
});

sbodanapu
18 Jul 2012, 8:15 PM
Hi redraid,
I am very thankful for your quick reply.
I observed that Ext.grid.feature exists in Ext-Js 4 but not in Ext -Js 3 .
Now, i am using Ext-Js 3 version..I forgot to mention it in my thread

Thanks & Regards,
Sandeep