Ext. Data. jsonstore is also a sub-class of store, with the goal of making it easier to use JSON objects as data sources.
Fields and root are added in the structure. The usage is as follows:
/**//*
This is a remote object. The returned content is consistent with the data of the local object below.
VaR store = new Ext. Data. jsonstore ({
URL: 'jsoncallback. js' ,
Root: 'rows ',
Fields: ['id', 'name', 'occupation']
});
Store. Load ();
*/
VaR store = new Ext. Data. jsonstore (...{
Data:... {'results': 2, 'rows ':[
... {'Id': 1, 'name': 'Bill ', Occupation: 'gardener '},
... {'Id': 2, 'name': 'ben', Occupation: 'horticulturalist '}
]},
Autoload: True,
Root: 'rows ',
Fields: ['id', 'name', 'occupation']
})
// skip gridpanel before proceeding.
var grid = new Ext. grid. gridpanel (... {
DS: store,
columns: [
... {header: "ID", width: 200, sortable: True, dataindex: 'id'},
... {header: "name", width: 200, sortable: True, dataindex: 'name'},
... {header: "Occupation", width: 200, sortable: True, dataindex: 'occupation'}
], height: 350,
width: 620,
title: 'array grid',
renderto: 'div _ gridpanel '
});