Class type Ext_data_Model.t


class type t = object .. end
Inherits
method dirty : bool Js.t Js.readonly_prop

True if this Record has been modified.

Defaults to: false

method editing : bool Js.t Js.readonly_prop

Internal flag used to track whether or not the model instance is currently being edited.

Defaults to: false

method fields : Ext_util_MixedCollection.t Js.t Js.prop

A Collection of the fields defined for this Model (including fields defined in superclasses)

This is a collection of Ext.data.Field instances, each of which encapsulates information that the field was configured with. By default, you can specify a field as simply a String, representing the name of the field, but a Field encapsulates data type, custom conversion of raw data, and a mapping property to specify by name of index, how to extract a field's value from a raw data object.


method isModel : bool Js.t Js.prop

true in this class to identify an object as an instantiated Model, or subclass thereof.

Defaults to: true

method modified : 'a. 'a Js.t Js.prop

Key: value pairs of all fields whose values have changed


method phantom : bool Js.t Js.prop

True when the record does not yet exist in a server-side database (see setDirty). Any record which has a real database pk set as its id property is NOT a phantom -- it's real.

Defaults to: false

method raw : 'b. 'b Js.t Js.prop

The raw data used to create this model if created via a reader.


method store : 'c. 'c Js.t Js.prop

The Store to which this instance belongs. NOTE: If this instance is bound to multiple stores, this property will reference only the first. To examine all the stores, use the stores property instead.


method stores : 'd. 'd Js.js_array Js.t Js.prop

The Stores to which this instance is bound.


method beginEdit : unit Js.meth

Begins an edit. While in edit mode, no events (e.g.. the update event) are relayed to the containing store. When an edit has begun, it must be followed by either endEdit or cancelEdit.


method cancelEdit : unit Js.meth

Cancels all changes made in the current edit operation.


method commit : bool Js.t Js.optdef ->
Js.js_string Js.t Js.js_array Js.t Js.optdef -> unit Js.meth

Usually called by the Ext.data.Store which owns the model instance. Commits all changes made to the instance 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:


method copy : Js.js_string Js.t Js.optdef ->
(< addEvents : 'g. 'g Js.t -> unit Js.meth;
addListener : 'h 'i 'j 'k 'l.
'h Js.t ->
'i Js.callback Js.optdef ->
'j Js.t Js.optdef -> 'k Js.t Js.optdef -> 'l Js.t Js.meth;
addManagedListener : 'm 'n 'o 'p 'q 'r.
'm Js.t ->
'n Js.t ->
'o Js.callback Js.optdef ->
'p Js.t Js.optdef ->
'q Js.t Js.optdef -> 'r Js.t Js.meth;
beginEdit : unit Js.meth; callParent : 's 't. 's Js.t -> 't Js.t Js.meth;
callSuper : 'u 'v. 'u Js.t -> 'v Js.t Js.meth; cancelEdit : unit Js.meth;
clearListeners : unit Js.meth; clearManagedListeners : unit Js.meth;
commit : bool Js.t Js.optdef ->
Js.js_string Js.t Js.js_array Js.t Js.optdef -> unit Js.meth;
copy : 'e; destroy : 'w. 'w Js.t -> 'f Js.t Js.meth;
dirty : bool Js.t Js.readonly_prop; editing : bool Js.t Js.readonly_prop;
enableBubble : 'x. 'x Js.t -> unit Js.meth;
endEdit : bool Js.t Js.optdef ->
Js.js_string Js.t Js.js_array Js.t Js.optdef -> unit Js.meth;
fields : Ext_util_MixedCollection.t Js.t Js.prop;
fireEvent : 'y. Js.js_string Js.t -> 'y Js.t -> bool Js.t Js.meth;
fireEventArgs : 'z.
Js.js_string Js.t ->
'z Js.t Js.js_array Js.t -> bool Js.t Js.meth;
get : 'a1. Js.js_string Js.t -> 'a1 Js.t Js.meth;
getAssociatedData : 'b1. 'b1 Js.t Js.meth;
getChanges : 'c1. 'c1 Js.t Js.meth;
getData : 'd1. bool Js.t -> 'd1 Js.t Js.meth;
getId : 'e1. 'e1 Js.t Js.meth;
getInitialConfig : 'f1. Js.js_string Js.t Js.optdef -> 'f1 Js.t Js.meth;
getProxy : 'g1. 'g1 Js.t Js.meth;
hasListener : Js.js_string Js.t -> bool Js.t Js.meth;
hasListeners : 'h1. 'h1 Js.t Js.readonly_prop;
initConfig : 'i1. 'i1 Js.t -> 'f Js.t Js.meth;
isModel : bool Js.t Js.prop;
isModified : Js.js_string Js.t -> bool Js.t Js.meth;
isObservable : bool Js.t Js.prop; isValid : bool Js.t Js.meth;
join : 'j1. 'j1 Js.t -> unit Js.meth; modified : 'a. 'a Js.t Js.prop;
mon : 'k1 'l1 'm1 'n1 'o1 'p1.
'k1 Js.t ->
'l1 Js.t ->
'm1 Js.callback Js.optdef ->
'n1 Js.t Js.optdef -> 'o1 Js.t Js.optdef -> 'p1 Js.t Js.meth;
mun : 'q1 'r1 's1 't1.
'q1 Js.t ->
'r1 Js.t ->
's1 Js.callback Js.optdef -> 't1 Js.t Js.optdef -> unit Js.meth;
on : 'u1 'v1 'w1 'x1 'y1.
'u1 Js.t ->
'v1 Js.callback Js.optdef ->
'w1 Js.t Js.optdef -> 'x1 Js.t Js.optdef -> 'y1 Js.t Js.meth;
phantom : bool Js.t Js.prop; raw : 'b. 'b Js.t Js.prop;
reject : bool Js.t Js.optdef -> unit Js.meth;
relayEvents : 'z1 'a2.
'z1 Js.t ->
Js.js_string Js.t Js.js_array Js.t ->
Js.js_string Js.t Js.optdef -> 'a2 Js.t Js.meth;
removeListener : 'b2 'c2.
Js.js_string Js.t ->
'b2 Js.callback -> 'c2 Js.t Js.optdef -> unit Js.meth;
removeManagedListener : 'd2 'e2 'f2 'g2.
'd2 Js.t ->
'e2 Js.t ->
'f2 Js.callback Js.optdef ->
'g2 Js.t Js.optdef -> unit Js.meth;
resumeEvent : Js.js_string Js.t -> unit Js.meth;
resumeEvents : unit Js.meth;
save : 'h2. 'h2 Js.t Js.optdef -> 'f Js.t Js.meth;
self : Ext_Class.t Js.t Js.prop;
set : 'i2 'j2.
'i2 Js.t -> 'j2 Js.t -> Js.js_string Js.t Js.js_array Js.t Js.meth;
setDirty : unit Js.meth; setId : 'k2. 'k2 Js.t -> unit Js.meth;
setProxy : 'l2 'm2. 'l2 Js.t -> 'm2 Js.t Js.meth;
statics : Ext_Class.t Js.t Js.meth; store : 'c. 'c Js.t Js.prop;
stores : 'd. 'd Js.js_array Js.t Js.prop;
suspendEvent : Js.js_string Js.t -> unit Js.meth;
suspendEvents : bool Js.t -> unit Js.meth;
un : 'n2 'o2.
Js.js_string Js.t ->
'n2 Js.callback -> 'o2 Js.t Js.optdef -> unit Js.meth;
unjoin : 'p2. 'p2 Js.t -> unit Js.meth;
validate : Ext_data_Errors.t Js.t Js.meth; .. >
as 'f)
Js.t Js.meth as 'e

Creates a copy (clone) of this Model instance.

Parameters:


method destroy : 'w. 'w Js.t -> 'f Js.t Js.meth

Destroys the model using the configured proxy.

Parameters:

Returns:


method endEdit : bool Js.t Js.optdef ->
Js.js_string Js.t Js.js_array Js.t Js.optdef -> unit Js.meth

Ends an edit. If any data was modified, the containing store is notified (ie, the store's update event will fire).

Parameters:


method get : 'a1. Js.js_string Js.t -> 'a1 Js.t Js.meth

Returns the value of the given field

Parameters:

Returns:


method getAssociatedData : 'b1. 'b1 Js.t Js.meth

Gets all of the data from this Models loaded associations. It does this recursively - for example if we have a User which hasMany Orders, and each Order hasMany OrderItems, it will return an object like this:

{
    orders: [
        {
            id: 123,
            status: 'shipped',
            orderItems: [
                ...
            ]
        }
    ]
}

Returns:


method getChanges : 'c1. 'c1 Js.t Js.meth

Gets a hash of only the fields that have been modified since this Model was created or commited.


method getData : 'd1. bool Js.t -> 'd1 Js.t Js.meth

Gets all values for each field in this model and returns an object containing the current data.

Parameters:

Returns:


method getId : 'e1. 'e1 Js.t Js.meth

Returns the unique ID allocated to this model instance as defined by idProperty.

Returns:


method getProxy : 'g1. 'g1 Js.t Js.meth

Returns the configured Proxy for this Model.

Returns:


method isModified : Js.js_string Js.t -> bool Js.t Js.meth

Returns true if the passed field name has been modified since the load or last commit.

Parameters:


method isValid : bool Js.t Js.meth

Checks if the model is valid. See validate.

Returns:


method join : 'j1. 'j1 Js.t -> unit Js.meth

Tells this model instance that it has been added to a store.

Parameters:


method reject : bool Js.t Js.optdef -> unit Js.meth

Usually called by the Ext.data.Store to which this model instance has been joined. Rejects all changes made to the model instance 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:


method save : 'h2. 'h2 Js.t Js.optdef -> 'f Js.t Js.meth

Saves the model instance using the configured proxy.

Parameters:

Returns:


method set : 'i2 'j2. 'i2 Js.t -> 'j2 Js.t -> Js.js_string Js.t Js.js_array Js.t Js.meth

Sets the given field to the given value, marks the instance as dirty

Parameters:

Returns:


method setDirty : unit Js.meth

Marks this Record as dirty. This method is used interally when adding phantom records to a writer enabled store.

Marking a record dirty causes the phantom to be returned by Ext.data.Store.getUpdatedRecords where it will have a create action composed for it during model save operations.


method setId : 'k2. 'k2 Js.t -> unit Js.meth

Sets the model instance's id field to the given id.

Parameters:


method setProxy : 'l2 'm2. 'l2 Js.t -> 'm2 Js.t Js.meth

Sets the Proxy to use for this model. Accepts any options that can be accepted by Ext.createByAlias.

Parameters:


method unjoin : 'p2. 'p2 Js.t -> unit Js.meth

Tells this model instance that it has been removed from the store.

Parameters:


method validate : Ext_data_Errors.t Js.t Js.meth

Validates the current data against all of its configured validations.

Returns: