PDA

View Full Version : how to read data from Json in groupingStore for groupingGrid



varsha
18 Jan 2011, 11:42 PM
I am reading json to load data for store of a normal grid.. but unable to do the same for a grouping store -

For a normal store, I read json as below -


var store0 =new Ext.data.Store({

proxy

:new Ext.data.HttpProxy({

url:'http://localhost:8080/mocks/tab/jsonStr0.json' (http://www.sencha.com/forum/'http://localhost:8080/mocks/tab/jsonStr0.json'),



timeout:300000// set to 5 minutes 5 * 60 * 1000



}),
reader:new Ext.data.DynamicJsonReader({}),



remoteSort:true,



successProperty:'success',



autoLoad:false



});


store0.load();


var grid0 =new Ext.grid.GridPanel({
width:790,



height:150,



cm:new Ext.grid.DynamicColumnModel(store0),



selModel:new Ext.grid.RowSelectionModel({



singleSelect:true



}),
store: store0,



stripeRows:true,



stateful:true,



viewConfig:{



forceFit:false



}
});

And I am using arrays to load grouping store as below -


var reader1 =new Ext.data.ArrayReader({},[{



name:'partNumber'



},{name:'package'



},{name:'packingStyle'



},{name:'operatingTemperature'



},{name:'numberofChannels'



}]);
var store1 =new Ext.data.GroupingStore({
reader: reader1,



data: xg.dummyData1,



sortInfo:{field:'package',direction:"ASC"},


groupField:'partNumber'



});


var grid1 =new xg.GridPanel({
store: store1,



columns:[{header:"Part Number",width:60,sortable:true,dataIndex:'partNumber'},{


id:'package',header:"Package",width:130,sortable:true,dataIndex:'package'},{


header:"Packing Style",width:75,sortable:true,dataIndex:'packingStyle'},{


header:"Operating Temperature",width:100,sortable:true,dataIndex:'operatingTemperature'},{


header:"Number of Channels",width:80,sortable:true,dataIndex:'numberofChannels'}],



view:new Ext.grid.GroupingView({forceFit:true,groupTextTpl:'{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'}),



frame:true,
width:800,
height:220,



border:false,



collapsible:false,



animCollapse:false,



iconCls:'icon-grid'




});



Ext.grid.dummyData1 =[['MC34DT13','SO 14.15 TO JEDEC MS-012','Tube','-40 to 151','1'],['MC34DT33','SO 14.15 TO JEDEC MS-022','Tape And Panel','-40 to 141','2']];




But now I want to load the grouping store using json.. Please help.. Any kind of help is appreciated !!

Condor
19 Jan 2011, 12:58 AM
And what exactly is the problem? Define a proxy for store1 and have your server return the data that is now in Ext.grid.dummyData1.

amanind
8 Feb 2011, 10:59 PM
Condor Can you please clean you private message space
While sending you message on forum I got this reply

"Condor has exceeded their stored private messages quota and cannot accept further messages until they clear some space."

and can you reply on this thread
http://www.sencha.com/forum/showthread.php?123323-Want-to-display-values-in-alphabetic-order-in-grid

Condor
12 Feb 2011, 2:45 AM
I cleared my mailbox, so you can send PMs again.