Print Friendly

# Class Ext.data.Record

Package: | Ext.data
Class: | Record
Extends: | Object
Defined In: | Record.js

Instances of this class encapsulate both record definition information, and record value information for use in Ext.data.Store objects, or any code which needs to access Records cached in an Ext.data.Store object.

Constructors for this class are generated by passing an Array of field definition objects to create and instances are usually only created by Ext.data.Reader objects when processing unformatted data objects.

Record objects generated by this constructor inherit all the methods of Ext.data.Record listed below.

Properties - Methods - Events

## Public Properties

Property | Defined By
--- | ---
| dirty : Boolean | Record
Readonly flag - true if this record has been modified.

## Public Methods

Method | Defined By
--- | ---
| Record(`data {Array}`, `id (Optional)`) | 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...
| get(`name {String}`) : 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(`name {String}`, `value {Object}`) : void | Record
Set the named field to the specified value.

## Public Events

This class has no public events.

## Property Details

### dirty

`public Boolean dirty`
Readonly flag - true if this record has been modified.
This property is defined by Record.

## Constructor Details

### Record

`public function Record(`data {Array}`, `id (Optional)`)`
This constructor should not be used to create Record objects. Instead, use the constructor generated by create. The parameters are the same.
Parameters:

- `{Array}` : data
  An associative Array of data values keyed by the field name.
- `(Optional)` : id
  The id of the record. This id should be unique, and is used by the @link Ext.data.Store} object which owns the Record to index its collection of Records. If not specified an integer id is generated.

## Method Details

### commit

`public function commit()`
Usually called by the Ext.data.Store which owns the Record. Commits all changes made to the Record since either creation, or the last commit operation.

Developers should subscribe to the Ext.data.Store.update event to have their code notified of commit operations.

Parameters:

- None.

Returns:

- `void`

This method is defined by Record.

### get

`public function get(`name {String}`)`
Get the value of the named field.
Parameters:

- `{String}` : name
  The name of the field to get the value of.

Returns:

- `Object`
  The value of the field.

This method is defined by Record.

### reject

`public function reject()`
Usually called by the Ext.data.Store which owns the Record. Rejects all changes made to the Record since either creation, or the last commit operation. Modified fields are reverted to their original values.

Developers should subscribe to the Ext.data.Store.update event to have their code notified of reject operations.

Parameters:

- None.

Returns:

- `void`

This method is defined by Record.

### set

`public function set(`name {String}`, `value {Object}`)`
Set the named field to the specified value.
Parameters:

- `{String}` : name
  The name of the field to set.
- `{Object}` : value
  The value to set the field to.

Returns:

- `void`

This method is defined by Record.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.