PDA

View Full Version : GridPanel + GroupingView + GroupingStore



cybermerlin
10 Jan 2011, 5:00 AM
is see jsonData :-?

{
"rows": 2,
"root": [
{
"id": 1,
"FullName": "asdf",
"Depart": "zxcv",
"Company": "vfdsfs",
"Status": "6356yrg",
"CA": "NWUDCCA1SUB1",
"SN": "61647C0F000000000006",
"ExprDate": "2006-02-10"
},
{
"id": 2,
"FullName": "as555555df",
"Depart": "zxcv",
"Company": "vfdsfs",
"Status": "6356yrg",
"CA": "NWUDCCA1SUB1",
"SN": "61647C0F000000000006",
"ExprDate": "2006-02-10"
}
]
}
but grid has no rows


Ext.onReady(function(){
Ext.QuickTips.init();

grid = new Ext.grid.GridPanel({
ds: new Ext.data.GroupingStore({
//autoLoad: true,
url: 'http://192.168.188.129/crl_udc/totals-hybrid.php',
reader: new Ext.data.JsonReader(
{root:'data'},
[
{name: 'fullname', type: 'string', mapping:'FullName',sortType:Ext.data.SortTypes.asUCString},
{name: 'company', type: 'string', mapping:'Company',sortType:Ext.data.SortTypes.asUCString},
{name: 'depart', type: 'string', mapping: 'Depart',sortType:Ext.data.SortTypes.asUCString},
{name: 'status', type: 'string', mapping:'Status',sortType:Ext.data.SortTypes.asUCString},
{name: 'ca', type: 'string', mapping:'CA',sortType:Ext.data.SortTypes.asUCString},
{name: 'sn', type: 'string', mapping:'SN',sortType:Ext.data.SortTypes.asUCString},
{name: 'exprdate', type: 'date', dateFormat:'m/d/Y', mapping:'ExprDate',sortType:Ext.data.SortTypes.asDate}
]),
idProperty: 'fullname',
sortInfo: {field: 'fullname', direction: 'ASC'},
groupField: 'company'
}),

columns: [
{ id: 'fullname', header: '??????? ??? ????????<br/>&nbsp;', width: 80, sortable: true, dataIndex: 'fullname', hideable: true },
{ header: '???????????<br/>&nbsp;', width: 20, sortable: true, dataIndex: 'company', hideable: true },
{ header: '?????????<br/>&nbsp;', width: 20, sortable: true, dataIndex: 'depart', hideable: true },
{ header: '??????<br/>&nbsp;', width: 20, sortable: true, dataIndex: 'status', hideable: true },
{ header: '??<br/>&nbsp;', width: 20, sortable: true, dataIndex: 'ca', hideable: true },
{ header: '????????<br/>?????&nbsp;', width: 20, sortable: true, dataIndex: 'sn', hideable: true },
{ header: '???????<br/>??', width: 25, sortable: true, dataIndex: 'exprdate', renderer: Ext.util.Format.dateRenderer('m/d/Y'), hideable: true }
],

view: new Ext.grid.GroupingView({
forceFit:true,
showGroupName: false,
//enableNoGroups:false,
hideGroupedColumn: true,
groupOnSort: true//,
//groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Rechnungen" : "Rechnung"]})'
}),

frame: true,
width: 800,
height: 450,
clicksToEdit: 1,
collapsible: true,
animCollapse: false,
trackMouseOver: false,
//enableColumnMove: false,
title: 'Sponsored Projects',
iconCls: 'icon-grid',
renderTo: document.body
});
grid.store.load();

});