Roo.data.DataReader
Roo.data.JsonReader 

		   

Class Roo.data.JsonReader

Package:Roo.data
Defined In: Roo/data/JsonReader.js.
Class:JsonReader
Extends: Roo.data.DataReader
Data reader class to create an Array of Roo.data.Record objects from a JSON response
based on mappings in a provided Roo.data.Record constructor.

The default behaviour of a store is to send ?_requestMeta=1, unless the class has recieved 'metaData' property
in the reply previously.


Example code:


var RecordDef = Roo.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 Roo.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)
}, RecordDef);


This would consume a JSON file like this:


{ 'results': 2, 'rows': [
{ 'id': 1, 'name': 'Bill', occupation: 'Gardener' },
{ 'id': 2, 'name': 'Ben', occupation: 'Horticulturalist' } ]
}
Class Comments / Notes => [Add Your comment/notes about this class]
Config Options (Usually are also Properties)
Options Defined By
Public Properties - Has None
Public Methods
Method Defined By
Events - Has None
Documentation generated by Introspection Doc Generator on Fri Jul 13 2018 14:10:54 GMT+0800 (HKT) Based on JsDoc Toolkit