Package: | Ext.data |
Defined In: | Record.js |
Class: | Record |
Extends: | Object |
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. Instances are usually only created by Ext.data.Reader implementations when processing unformatted data objects.
Note that an instance of a Record class may only belong to one Store at a time. In order to copy data from one Store to another, use the copy method to create an exact copy of the Record, and insert the new instance into the other Store.
When serializing a Record for submission to the server, be aware that it contains many private
properties, and also a reference to its owning Store which in turn holds references to its Records.
This means that a whole Record may not be encoded using Ext.util.JSON.encode. Instead, use the
data
and id
properties.
Record objects generated by this constructor inherit all the methods of Ext.data.Record listed below.
Property | Defined By | |
---|---|---|
data : Object An object hash representing the data for this Record. Every field name in the Record definition
is represented by a p... An object hash representing the data for this Record. Every field name in the Record definition
is represented by a property of that name in this object. Note that unless you specified a field
with name "id" in the Record definition, this will not contain
an id property. | Record | |
dirty : Boolean Readonly flag - true if this Record has been modified. | Record | |
fields : Ext.util.MixedCollection This property is stored in the Record definition's prototype
A MixedCollection containing the defined Fields for this... This property is stored in the Record definition's prototype A MixedCollection containing the defined Fields for this Record. Read-only. | Record | |
id : Object The unique ID of the Record as specified at construction time. | Record | |
json : Array|Object Only present if this Record was created by an ArrayReader or a JsonReader.
The Array or object which was the source o... Only present if this Record was created by an ArrayReader or a JsonReader. The Array or object which was the source of the data for this Record. | Record | |
modified : Object This object contains a key and value storing the original values of all modified
fields or is null if no fields have ... This object contains a key and value storing the original values of all modified
fields or is null if no fields have been modified. | Record | |
node : XMLElement Only present if this Record was created by an XmlReader.
The XML element which was the source of the data for this Re... Only present if this Record was created by an XmlReader. The XML element which was the source of the data for this Record. | Record | |
phantom : Boolean true when the record does not yet exist in a server-side database (see
markDirty). Any record which has a real datab... true when the record does not yet exist in a server-side database (see
markDirty). Any record which has a real database pk set as its id property
is NOT a phantom -- it's real. | Record | |
store : Ext.data.Store The Ext.data.Store to which this Record belongs. | Record |
Method | Defined By | |
---|---|---|
Record( [Object data ], [Object id ] )
This constructor should not be used to create Record objects. Instead, use create to
generate a subclass of Ext.data.... This constructor should not be used to create Record objects. Instead, use create to generate a subclass of Ext.data.Record configured with information about its constituent fields.
The generated constructor has the same signature as this constructor. Parameters:
| Record | |
Record.id( Record rec )
:
StringGenerates a sequential id. This method is typically called when a record is created
and no id has been specified. The... Generates a sequential id. This method is typically called when a record is created
and no id has been specified. The returned id takes the form:
{PREFIX}-{AUTO_ID}.
Parameters:
| Record | |
beginEdit()
:
void Begin an edit. While in edit mode, no events (e.g.. the update event)
are relayed to the containing store.
See also: ... Begin an edit. While in edit mode, no events (e.g.. the update event)
are relayed to the containing store.
See also: endEdit and cancelEdit .Parameters:
| Record | |
cancelEdit()
:
void Cancels all changes made in the current edit operation. Cancels all changes made in the current edit operation. Parameters:
| Record | |
commit( [Boolean silent ] )
:
voidUsually called by the Ext.data.Store which owns the Record.
Commits all changes made to the Record since either creat... 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:
| Record | |
copy( [String id ] )
:
RecordCreates a copy (clone) of this Record. Creates a copy (clone) of this Record. Parameters:
| Record | |
create( Array o )
:
Function<static> Generate a constructor for a specific Record layout. <static> Generate a constructor for a specific Record layout. Parameters:
| Record | |
endEdit()
:
void End an edit. If any data was modified, the containing store is notified
(ie, the store's update event will fire). End an edit. If any data was modified, the containing store is notified
(ie, the store's update event will fire).Parameters:
| Record | |
get( String name )
:
ObjectGet the value of the named field. Get the value of the named field. Parameters:
| Record | |
getChanges()
:
Object Gets a hash of only the fields that have been modified since this Record was created or commited. Gets a hash of only the fields that have been modified since this Record was created or commited. Parameters:
| Record | |
isModified( String fieldName )
:
BooleanReturns true if the passed field name has been modified
since the load or last commit. Returns true if the passed field name has been modified
since the load or last commit.Parameters:
| Record | |
isValid()
:
Boolean By default returns false if any field within the
record configured with Ext.data.Field.allowBlank = false returns
tru... By default returns false if any field within the
record configured with Ext.data.Field.allowBlank = false returns
true from an Ext.isempty test. Parameters:
| Record | |
markDirty()
:
void Marks this Record as dirty. This method
is used interally when adding phantom records to a
writer enabled store.
Mar... Marks this Record as Marking a record Parameters:
| Record | |
reject( [Boolean silent ] )
:
voidUsually called by the Ext.data.Store which owns the Record.
Rejects all changes made to the Record since either creat... 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:
| Record | |
set( String name , String/Object/Array value )
:
voidSet the named field to the specified value. For example:
// record has a field named 'firstname'
var Employee = Ext.... Set the named field to the specified value. For example:
Notes:Parameters:
| Record |