Package: | Ext.data |
Class: | Record |
Extends: | Object |
Defined In: | Record.js |
Constructors for this class are generated by passing an Array of field definition objects to create.
Instances are usually only created by Ext.data.Reader implementations when processing unformatted data
objects.
Record objects generated by this constructor inherit all the methods of Ext.data.Record listed below.
Property | Defined By | |
---|---|---|
dirty : Boolean | Record | |
Readonly flag - true if this record has been modified. |
Method | Defined By | |
---|---|---|
Record( Array data , [Object id ] ) |
Record | |
This constructor should not be used to create Record objects. Instead, use the constructor generated by create. The p... | ||
commit() : void | Record | |
Usually called by the Ext.data.Store which owns the Record. Commits all changes made to the Record since either creat... | ||
copy( [String id ] ) : Record |
Record | |
Creates a copy of this record. | ||
create( [Array o ] ) : void |
Record | |
<static> Generate a constructor for a specific record layout. | ||
get( String name ) : Object |
Record | |
Get the value of the named field. | ||
reject() : void | Record | |
Usually called by the Ext.data.Store which owns the Record. Rejects all changes made to the Record since either creat... | ||
set( String name , Object value ) : void |
Record | |
Set the named field to the specified value. |
public Boolean dirty
public function Record( Array data
, [Object id
] )
data
: Arrayid
: Objectpublic function commit()
Developers should subscribe to the Ext.data.Store.update event to have their code notified of commit operations.
void
public function copy( [String id
] )
id
: StringRecord
public function create( [Array o
] )
o
: ArrayThe name by which the field is referenced within the Record. This is referenced by, for example the dataIndex property in column definition objects passed to Ext.grid.ColumnModel
(Optional) A path specification for use by the Ext.data.Reader implementation that is creating the Record to access the data value from the data object. If an Ext.data.JsonReader is being used, then this is a string containing the javascript expression to reference the data relative to the record item's root. If an Ext.data.XmlReader is being used, this is an Ext.DomQuery path to the data item relative to the record element. If the mapping expression is the same as the field name, this may be omitted.
(Optional) The data type for conversion to displayable value. Possible values are
(Optional) A member of Ext.data.SortTypes.
(Optional) Initial direction to sort. "ASC" or "DESC"
(Optional) A function which converts the value provided by the Reader into an object that will be stored in the Record. It is passed the following parameters:
The data value as read by the Reader.
(Optional) A format String for the Date.parseDate function.
var TopicRecord = Ext.data.Record.create(
{name: 'title', mapping: 'topic_title'},
{name: 'author', mapping: 'username'},
{name: 'totalPosts', mapping: 'topic_replies', type: 'int'},
{name: 'lastPost', mapping: 'post_time', type: 'date'},
{name: 'lastPoster', mapping: 'user2'},
{name: 'excerpt', mapping: 'post_text'}
);
var myNewRecord = new TopicRecord({
title: 'Do my job please',
author: 'noobie',
totalPosts: 1,
lastPost: new Date(),
lastPoster: 'Animal',
excerpt: 'No way dude!'
});
myStore.add(myNewRecord);
void
public function get( String name
)
name
: StringObject
public function reject()
Developers should subscribe to the Ext.data.Store.update event to have their code notified of reject operations.
void
public function set( String name
, Object value
)
name
: Stringvalue
: Objectvoid