DataReaderJsonReader
Package: | Ext.data |
Defined In: | JsonReader.js |
Class: | JsonReader |
Extends: | DataReader |
Example code:
var Employee = Ext.data.Record.create([
{name: 'name', mapping: 'name'}, // "mapping" property not needed if it's the same as "name"
{name: 'occupation'} // This field will use "occupation" as the mapping.
]);
var myReader = new Ext.data.JsonReader({
totalProperty: "results", // The property which contains the total dataset size (optional)
root: "rows", // The property which contains an Array of row objects
id: "id" // The property within each row object that provides an ID for the record (optional)
}, Employee);
This would consume a JSON file like this:
{ 'results': 2, 'rows': [
{ 'id': 1, 'name': 'Bill', occupation: 'Gardener' },
{ 'id': 2, 'name': 'Ben', occupation: 'Horticulturalist' } ]
}
Method | Defined By | |
---|---|---|
JsonReader( Object meta , Object recordType ) Create a new JsonReader
Create a new JsonReader
Parameters:
|
JsonReader | |
read( Object response ) : Object This method is only used by a DataProxy which has retrieved data from a remote server.
This method is only used by a DataProxy which has retrieved data from a remote server.
Parameters:
|
JsonReader | |
readRecords( Object o ) : Object Create a data block containing Ext.data.Records from an XML document.
Create a data block containing Ext.data.Records from an XML document.
Parameters:
|
JsonReader |