Properties Methods Events Config Options Direct Link
DataReader
  JsonReader

Class Ext.data.JsonReader

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

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' } ]
}

Config Options

Config Options Defined By
  id : String
Name of the property within a row object that contains a record identifier value.
JsonReader
  root : String
name of the property which contains the Array of row objects.
JsonReader
  successProperty : String
Name of the property from which to retrieve the success attribute used by forms.
JsonReader

Public Properties

Property Defined By

Public Methods

Method Defined By

Public Events

This class has no public events.