Class Index | File Index

## Classes

- _global_
- M
- M.ActionSheetDialogView
- M.AlertDialogView
- M.Application
- M.Base64
- M.ButtonGroupView
- M.ButtonView
- M.ConfirmDialogView
- M.ContainerView
- M.Controller
- M.Cypher
- M.DataProvider
- M.Date
- M.DateValidator
- M.EmailValidator
- M.Environment
- M.EventDispatcher
- M.FormView
- M.GridView
- M.I18N
- M.ImageView
- M.LabelView
- M.ListItemView
- M.ListView
- M.LoaderView
- M.LocalStorageProvider
- M.Logger
- M.Math
- M.Model
- M.ModelAttribute
- M.ModelRegistry
- M.NotMinusValidator
- M.NumberValidator
- M.Object
- M.Observable
- M.PageView
- M.PhoneValidator
- M.PresenceValidator
- M.RecordManager
- M.RemoteStorageProvider
- M.Request
- M.ScrollView
- M.SearchBarView
- M.SelectionListItemView
- M.SelectionListView
- M.SHA256
- M.TabBarItemView
- M.TabBarView
- M.TextFieldView
- M.ToggleView
- M.ToolbarView
- M.UrlValidator
- M.Validator
- M.View
- M.ViewManager
- M.WebSqlProvider

# Class M.ModelAttribute

Extends M.Object.
M.ModelAttribute encapsulates all meta information about a model record's property: * is it required? * what data type is it of? (important for mapping to relational database schemas) * what validators shall be applied All M.ModelAttributes for a model record are saved under M.Model#__meta property of a model. Each ModelAttribute is saved with the record properties name as key. That means: model.record[propA] is the value of the property. model.__meta[propA] is the M.ModelAttribute object for the record property.
Defined in: model_attribute.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| M.ModelAttribute()

Field Summary
Field Attributes | Field Name and Description
--- | ---
| dataType The data type for the model record property.
| isRequired Indicates whether this property is required to be set before persisting.
| type The type of this object.
| validators Array containing all validators for this model record property.

Method Summary
Method Attributes | Method Name and Description
--- | ---
<static> | M.ModelAttribute.attr(dataType, opts) Returns a model attribute.
| validate(obj) Iterates over validators array and calls validate on each validator with the param object passed to the validator.

Methods borrowed from class M.Object:
  bindToCaller, create, destroy, extend, get, include, set

Class Detail
M.ModelAttribute()
Field Detail
{String} dataType
The data type for the model record property. Extremely important e.g. to map model to relational database table.

{Boolean} isRequired
Indicates whether this property is required to be set before persisting. If YES, then automatically @link M.PresenceValidator is added to the property, to check the presence.

{String} type
The type of this object.

{Object} validators
Array containing all validators for this model record property. E.g. [@link M.PresenceValidator, @link M.NumberValidator]
Method Detail
<static> {Object} M.ModelAttribute.attr(dataType, opts)
Returns a model attribute.

Parameters:
dataType
  The data type of the attribute: e.g. String
opts
  options for the attribute, such as defaultValue, isRequired flag, etc. ...

Returns:
  {Object} M.ModelAttribute object

{Boolean} validate(obj)
Iterates over validators array and calls validate on each validator with the param object passed to the validator.

Parameters:
{Object} obj
  The parameter object containing the model id, the record as M.ModelAttribute object and the value of the property.

Returns:
  {Boolean} Indicates wheter the property is valid (YES|true) or invalid (NO|false).

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Dec 08 2010 15:07:32 GMT+0100 (MEZ)