Properties Methods Events Config Options Direct Link

    DataReader
      JsonReader
        ArrayReader

# Class Ext.data.ArrayReader

Package: | Ext.data
Defined In: | ArrayReader.js
Class: | ArrayReader
Extends: | JsonReader

Data reader class to create an Array of Ext.data.Record objects from an Array. Each element of that Array represents a row of data fields. The fields are pulled into a Record object using as a subscript, the mapping property of the field definition if it exists, or the field's ordinal position in the definition.

Example code:.

    var Employee = Ext.data.Record.create([
        {name: 'name', mapping: 1},         // "mapping" only needed if an "id" field is present which
        {name: 'occupation', mapping: 2}    // precludes using the ordinal position as the index.
    ]);
    var myReader = new Ext.data.ArrayReader({
        id: 0                     // The subscript within row Array that provides an ID for the Record (optional)
    }, Employee);

This would consume an Array like this:

    [ [1, 'Bill', 'Gardener'], [2, 'Ben', 'Horticulturalist'] ]

## Config Options

Config Options | Defined By
--- | ---
| id : String (optional) The subscript within row Array that provides an ID for the Record | ArrayReader
| 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
| totalProperty : String Name of the property from which to retrieve the total number of records in the dataset. This is only needed if the wh... Name of the property from which to retrieve the total number of records in the dataset. This is only needed if the whole dataset is not passed in one go, but is being paged from the remote server. | JsonReader

## Public Properties

Property | Defined By
--- | ---
| jsonData : Object After any data loads, the raw JSON data is available for further custom processing. If no data is loaded or there is... After any data loads, the raw JSON data is available for further custom processing. If no data is loaded or there is a load exception this property will be undefined. | JsonReader
| meta : Mixed This DataReader's configured metadata as passed to the constructor. | DataReader

## Public Methods

Method | Defined By
--- | ---
| ArrayReader( `Object meta`, `Object recordType` ) Create a new ArrayReader Create a new ArrayReader Parameters: `meta` : Object Metadata configuration options. `recordType` : Object Either an Array of field definition objects as specified to Ext.data.Record.create, or a Record constructor created using Ext.data.Record.create. Returns: `` | ArrayReader
| 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: `response` : Object The XHR object which contains the JSON data in its responseText. Returns: `Object` data A data block which is used by an Ext.data.Store object as a cache of Ext.data.Records. | 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: `o` : Object An Array of row objects which represents the dataset. Returns: `Object` data A data block which is used by an Ext.data.Store object as a cache of Ext.data.Records. | ArrayReader

## Public Events

This class has no public events.