PDA

View Full Version : how to merge rows in a grid column



atul.sachan@capgemini.com
12 Feb 2013, 9:55 PM
Hello,

From the look & feel perspective i need to merge some rows in a grid column, is it possible? if yes then could you please provide any sample or link.

Thanks.

sword-it
13 Feb 2013, 4:41 AM
Hi Atul,

you can use grouping feature of grid, like-


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'
}
}
});


Ext.create('Ext.grid.Panel', {
title: 'Employees',
store: Ext.data.StoreManager.lookup('employeeStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Seniority', dataIndex: 'seniority' }
],
features: [{ftype:'grouping'}],
width: 200,
height: 275,
renderTo: Ext.getBody()
});


http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.feature.Grouping

scottmartin
13 Feb 2013, 10:46 AM
If the grouping does not answer you question, please provide more detail as to what behavior you are looking for as your description could be taken several ways.

Scott.