Roo.data.DataReader Roo.data.JsonReader
Package: | Roo.data |
Defined In: | Roo/data/JsonReader.js. |
Class: | JsonReader |
Extends: | Roo.data.DataReader |
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' } ]
}
Options | Defined By | |
---|---|---|
fields : Array
Array of field definition objects
Array of field definition objects
|
Roo.data.JsonReader | |
id : String
Name of the property within a row object that contains a record identifier value.
Name of the property within a row object that contains a record identifier value.
|
Roo.data.JsonReader | |
root : String
name of the property which contains the Array of row objects.
name of the property which contains the Array of row objects.
|
Roo.data.JsonReader | |
successProperty : String
Name of the property from which to retrieve the success attribute used by forms.
Name of the property from which to retrieve the success attribute used by forms.
|
Roo.data.JsonReader | |
totalProperty : String
Name of the property from which to retrieve the total number of records
in the dataset.
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. |
Roo.data.JsonReader |
Method | Defined By | |
---|---|---|
newRow
(Object data)
:
Roo.data.Record
Create an empty record
Create an empty record
|
Roo.data.DataReader | |
This method is only used by a DataProxy which has retrieved data from a remote server.
|
Roo.data.JsonReader | |
Create a data block containing Roo.data.Records from an XML document.
Create a data block containing Roo.data.Records from an XML document.
|
Roo.data.JsonReader |