Class type Ext_data_Model.configs


class type configs = object .. end
Inherits
method associations : 'a. 'a Js.t Js.js_array Js.t Js.prop

An array of associations for this model.


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

One or more BelongsTo associations for this model.


method clientIdProperty : Js.js_string Js.t Js.prop

The name of a property that is used for submitting this Model's unique client-side identifier to the server when multiple phantom records are saved as part of the same Operation. In such a case, the server response should include the client id for each record so that the server response data can be used to update the client-side records if necessary. This property cannot have the same name as any of this Model's fields.


method defaultProxyType : Js.js_string Js.t Js.prop

The string type of the default Model Proxy. Defaults to 'ajax'.

Defaults to: 'ajax'

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

The fields for this model. This is an Array of Field definition objects. A Field definition may simply be 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, so it is best practice to specify a full set of Field config objects.


method hasMany : 'd. 'd Js.t Js.prop

One or more HasMany associations for this model.


method idProperty : 'e. 'e Js.t Js.prop

The name of the field treated as this Model's unique id. Defaults to 'id'.

This may also be specified as a Field config object. This means that the identifying field can be calculated using a convert function which might aggregate several values from the raw data object to use as an identifier.

The resulting Field is added to the Model's field collection unless there is already a configured field with a mapping that reads the same property.

If defining an abstract base Model class, the idProperty may be configured as null which will mean that no identifying field will be generated.

Defaults to: 'id'

method idgen : 'f. 'f Js.t Js.prop

The id generator to use for this model. The default id generator does not generate values for the idProperty.

This can be overridden at the model level to provide a custom generator for a model. The simplest form of this would be:

 Ext.define('MyApp.data.MyModel', {
     extend: 'Ext.data.Model',
     requires: ['Ext.data.SequentialIdGenerator'],
     idgen: 'sequential',
     ...
 });

The above would generate sequential id's such as 1, 2, 3 etc..

Another useful id generator is Ext.data.UuidGenerator:

 Ext.define('MyApp.data.MyModel', {
     extend: 'Ext.data.Model',
     requires: ['Ext.data.UuidGenerator'],
     idgen: 'uuid',
     ...
 });

An id generation can also be further configured:

 Ext.define('MyApp.data.MyModel', {
     extend: 'Ext.data.Model',
     idgen: {
         type: 'sequential',
         seed: 1000,
         prefix: 'ID_'
     }
 });

The above would generate id's such as ID_1000, ID_1001, ID_1002 etc..

If multiple models share an id space, a single generator can be shared:

 Ext.define('MyApp.data.MyModelX', {
     extend: 'Ext.data.Model',
     idgen: {
         type: 'sequential',
         id: 'xy'
     }
 });

 Ext.define('MyApp.data.MyModelY', {
     extend: 'Ext.data.Model',
     idgen: {
         type: 'sequential',
         id: 'xy'
     }
 });

For more complex, shared id generators, a custom generator is the best approach. See Ext.data.IdGenerator for details on creating custom id generators.


method proxy : 'g. 'g Js.t Js.prop

The proxy to use for this model.


method validations : 'h. 'h Js.t Js.js_array Js.t Js.prop

An array of validations for this model.