Properties Methods Events Config Options Direct Link

# Class Ext.data.DataReader

Package: | Ext.data
Defined In: | DataReader.js
Class: | DataReader
Subclasses: | JsonReader, XmlReader
Extends: | Object

Abstract base class for reading structured data from a data source and converting it into an object containing Ext.data.Record objects and metadata for use by an Ext.data.Store. This class is intended to be extended and should not be created directly. For existing implementations, see Ext.data.ArrayReader, Ext.data.JsonReader and Ext.data.XmlReader.

## Config Options

Config Options | Defined By
--- | ---
| fields : Array/Object Either an Array of Field definition objects (which will be passed to Ext.data.Record.create, or a Record constructor ... Either an Array of Field definition objects (which will be passed to Ext.data.Record.create, or a Record constructor created from Ext.data.Record.create. | DataReader
| messageProperty : String [undefined] Optional name of a property within a server-response that represents a user-feedback message. | DataReader

## Public Properties

Property | Defined By
--- | ---
| buildExtractors : Object Abstract method, overridden in DataReader extensions such as Ext.data.JsonReader and Ext.data.XmlReader | DataReader
| extractValues : Object Abstract method overridden in DataReader extensions such as Ext.data.JsonReader and Ext.data.XmlReader | DataReader
| getId : Object Abstract method created in extension's buildExtractors impl. | DataReader
| getMessage : Object Abstract method created in extension's buildExtractors impl. | DataReader
| getRoot : Object Abstract method created in extension's buildExtractors impl. | DataReader
| getSuccess : Object Abstract method created in extension's buildExtractors impl. | DataReader
| getTotal : Object Abstract method created in extension's buildExtractors impl. | DataReader
| meta : Mixed This DataReader's configured metadata as passed to the constructor. | DataReader

## Public Methods

Method | Defined By
--- | ---

DataReader( `Object meta`, `Array/Object recordType` )
Create a new DataReader
Create a new DataReader
Parameters:

- `meta` : Object
  Metadata configuration options (implementation-specific).
- `recordType` : Array/Object

  Either an Array of Field definition objects (which will be passed to Ext.data.Record.create, or a Record constructor created using Ext.data.Record.create.

Returns:

- void

DataReader

isData( `Object data` ) : Boolean
Returns true if the supplied data-hash looks and quacks like data. Checks to see if it has a key corresponding to id...
Returns true if the supplied data-hash looks and quacks like data. Checks to see if it has a key corresponding to idProperty defined in your DataReader config containing non-empty pk.
Parameters:

- `data` : Object

Returns:

- `Boolean`

DataReader

realize( `Record/Record[] record`, `Object/Object[] data` ) : void
Used for un-phantoming a record after a successful database insert. Sets the records pk along with new data from ser...
Used for un-phantoming a record after a successful database insert. Sets the records pk along with new data from server. You must return at least the database pk using the idProperty defined in your DataReader configuration. The incoming data from server will be merged with the data in the local record. In addition, you must return record-data from the server in the same order received. Will perform a commit as well, un-marking dirty-fields. Store's "update" event will be suppressed.
Parameters:

- `record` : Record/Record[]
  The phantom record to be realized.
- `data` : Object/Object[]
  The new record data to apply. Must include the primary-key from database defined in idProperty field.

Returns:

- void

DataReader

update( `Record/Record[] rs`, `Object/Object[] data` ) : void
Used for updating a non-phantom or "real" record's data with fresh data from server after remote-save. If returning d...
Used for updating a non-phantom or "real" record's data with fresh data from server after remote-save. If returning data from multiple-records after a batch-update, you must return record-data from the server in the same order received. Will perform a commit as well, un-marking dirty-fields. Store's "update" event will be suppressed as the record receives fresh new data-hash
Parameters:

- `rs` : Record/Record[]
- `data` : Object/Object[]

Returns:

- void

DataReader

## Public Events

This class has no public events.