Tutorial Extjs Grouping
In this section i want to create a example about grouping in grid extjs. Usually grouping used to classifying data which have similarities, In this example i would classify by country. Ok, now i will try to explain more of code from this tutorial .
1. Create grouping store like this code
var SimpleDataStore = new Ext.data.GroupingStore({
proxy: new Ext.data.HttpProxy({
url: 'simplegridg.php',
method: 'POST'
}),
reader: new Ext.data.JsonReader({
root: 'results',
totalProperty: 'total'
},
[
//this is field in database
{name: 'id', type: 'int'},
{name: 'name', type: 'string'},
{name: 'address', type: 'string'},
{name: 'email', type: 'string'},
{name: 'country', type: 'string'}
]),
sortInfo:{field: 'country', direction: "ASC"},
groupField:'country' // this script used to classify by country
});
2. In grid panel create code to display the result of grouping. here is code
view: new Ext.grid.GroupingView({
forceFit:true,
groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
}),
This is a screen shot of this tutorial
Download source code
http://www.ziddu.com/download/9528336/grouping_data_gird.rar.html

hii
my grid data is not coming why not getting can you provide me the code of php file..
so i can check that thanks
rahul
nice post i really like it