|
| 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:data : Object(Optional) An object, the properties of which provide values for the new Record's
+fields. If not specified the defaultValue
+for each field will be assigned. id : Object(Optional) The id of the Record. The id is used by the
+ Ext.data.Store object which owns the Record to index its collection
+of Records (therefore this id should be unique within each store). If an
+ id is not specified a phantom
+Record will be created with an automatically generated id. Returns: | 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:rec : RecordThe record being created. The record does not exist, it's a phantom. Returns: | Record |
| beginEdit()
+ :
+ voidBegin 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 . | Record |
| cancelEdit()
+ :
+ voidCancels all changes made in the current edit operation. Cancels all changes made in the current edit operation. | 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:
-
- Returns:
-
-
-
-
- |
- Record |
-
-
- |
-
-
- copy( [String id ] ) : Record
- Creates a copy of this Record.
-
- Creates a copy of this Record.
- Parameters:
-
- Returns:
-
-
-
-
- |
- Record |
-
-
- |
-
-
- create( [Array o ] ) : function
- <static> Generate a constructor for a specific Record layout.
-
- <static> Generate a constructor for a specific Record layout.
- Parameters:
- o : ArrayAn Array of field definition objects which specify field names, and optionally,
-data types, and a mapping for an Ext.data.Reader to extract the field's value from a data object.
-Each field definition object may contain the following properties:
-The constructor generated by this method may be used to create new Record instances. The data object must contain properties
-named after the field names.
- usage: var TopicRecord = Ext.data.Record.create([
- {name: 'title', mapping: 'topic_title'},
- {name: 'author', mapping: 'username'},
+Developers should subscribe to the Ext.data.Store.update event
+to have their code notified of commit operations.
| Record |
| copy( [String id ] )
+ :
+ RecordCreates a copy (clone) of this Record. Creates a copy (clone) of this Record. Parameters:id : String(optional) A new Record id, defaults to the id
+of the record being copied. See id .
+To generate a phantom record with a new id use: var rec = record.copy(); // clone the record
+Ext.data.Record.id(rec); // automatically generate a unique sequential id
Returns: | Record |
| create( Array o )
+ :
+ function<static> Generate a constructor for a specific Record layout. <static> Generate a constructor for a specific Record layout. Parameters:o : ArrayAn Array of Field definition objects.
+The constructor generated by this method may be used to create new Record instances. The data
+object must contain properties named after the field
+ Ext.data.Field.names. Example usage: // create a Record constructor from a description of the fields
+var TopicRecord = Ext.data.Record.create([ // creates a subclass of Ext.data.Record
+ {name: 'title', mapping: 'topic_title'},
+ {name: 'author', mapping: 'username', allowBlank: false},
{name: 'totalPosts', mapping: 'topic_replies', type: 'int'},
{name: 'lastPost', mapping: 'post_time', type: 'date'},
{name: 'lastPoster', mapping: 'user2'},
- {name: 'excerpt', mapping: 'post_text'}
+ {name: 'excerpt', mapping: 'post_text', allowBlank: false},
+ // In the simplest case, if no properties other than name are required,
+ // a field definition may consist of just a String for the field name.
+ 'signature'
]);
-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);
- In the simplest case, if no properties other than name are required, a field definition
-may consist of just a field name string.
- Returns:
-
-
-
-
- |
- Record |
-
-
- |
-
-
- endEdit() : void
- End an edit. If any data was modified, the containing store is notified.
-
- End an edit. If any data was modified, the containing store is notified.
- Parameters:
-
- Returns:
-
-
-
-
- |
- Record |
-
-
- |
-
-
- get( String name ) : Object
- Get the value of the named field.
-
- Get the value of the named field.
- Parameters:
-
- Returns:
-
- Object The value of the field.
-
-
-
-
- |
- 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:
-
- Returns:
-
-
-
-
- |
- Record |
-
-
- |
-
-
- isModified( String fieldName ) : Boolean
- Returns true if the field passed has been modified since the load or last commit.
-
- Returns true if the field passed has been modified since the load or last commit.
- Parameters:
-
- Returns:
-
-
-
-
- |
- Record |
-
-
- |
-
-
- reject( [Boolean silent ] ) : void
- Usually 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.
+ // create Record instance
+ var myNewRecord = new TopicRecord(
+ {
+ title: 'Do my job please',
+ author: 'noobie',
+ totalPosts: 1,
+ lastPost: new Date(),
+ lastPoster: 'Animal',
+ excerpt: 'No way dude!',
+ signature: ''
+ },
+ id // optionally specify the id of the record otherwise one is auto-assigned
+);
+myStore. add(myNewRecord); Returns: | Record |
| endEdit()
+ :
+ voidEnd 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). | Record |
| get( String name )
+ :
+ ObjectGet the value of the named field. Get the value of the named field. Parameters:Returns:Object The value of the field.
| Record |
| getChanges()
+ :
+ ObjectGets 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. | 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. | Record |
| isValid()
+ :
+ BooleanBy default returns false if any field within the
+record configured with Ext.data.Field.allowBlank = false returns
+tru... | Record |
| markDirty()
+ :
+ voidMarks this Record as dirty. This method
+is used interally when adding phantom records to a
+writer enabled store.
+Mar... | 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:
-
- Returns:
-
-
-
-
- |
- Record |
-
-
- |
-
-
- set( String name , Object value ) : void
- Set the named field to the specified value.
-
- Set the named field to the specified value.
- Parameters:
-
- Returns:
-
-
-
-
- |
- Record |
-
-