MVC.Model
Class
- MVC.Model ()
Attributes
- clientId {Function} Generated client id.
- idAttribute {String} Attribute name used to store id from server.
- parse {function} parse json from server to get attr/value pairs.
- sync {Function} Sync model data with server.
- url {Function} Called to get url for delete/edit/new current model.
- urlRoot {String} If current model does not belong to any collection.
Methods
- addToCollection (c) Add current model instance to a specified collection.
- destroy (opts) destroy this model and sync with server.
- getId () Get current model 's id.
- isModified () whether has been modified since last save.
- isNew () whether it is newly created.
- load (opts) Load model data from server.
- removeFromCollection (c) Remove current model instance from a specified collection.
- save (opts) Save current model 's data to server using sync.
- setId (id) Set current model 's id.
- toJSON () Get json representation for current model.
Attributes Detail
-
clientId {Function} Generated client id. Default call S.guid()
-
idAttribute {String} Attribute name used to store id from server. Default: "id".
-
parse {function} parse json from server to get attr/value pairs. Default to return raw data from server.
-
sync {Function} Sync model data with server. Default to call MVC.sync
-
url {Function} Called to get url for delete/edit/new current model. Default: collection.url+"/"+mode.id
-
urlRoot {String} If current model does not belong to any collection. Use this attribute value as collection.url in MVC.Model#url
Methods Detail
-
addToCollection (c) view sourceAdd current model instance to a specified collection.
- Parameters
-
- c {MVC.Collection}
-
destroy (opts) view sourcedestroy this model and sync with server.
- Parameters
-
- [ opts ] {Object} destroy config.
- opts.success {Function} callback when action is done successfully.
- opts.error {Function} callback when error occurs at action.
- opts.complete {Function} callback when action is complete.
-
getId () view sourceGet current model 's id.
-
isModified () view sourcewhether has been modified since last save.
- Returns
-
- {Boolean}
-
isNew () view sourcewhether it is newly created.
- Returns
-
- {Boolean}
-
load (opts) view sourceLoad model data from server.
- Parameters
-
- opts {Object} Load config.
- opts.success {Function} callback when action is done successfully.
- opts.error {Function} callback when error occurs at action.
- opts.complete {Function} callback when action is complete.
-
removeFromCollection (c) view sourceRemove current model instance from a specified collection.
- Parameters
-
- c {MVC.Collection}
-
save (opts) view sourceSave current model 's data to server using sync.
- Parameters
-
- opts {Object} Save config.
- opts.success {Function} callback when action is done successfully.
- opts.error {Function} callback when error occurs at action.
- opts.complete {Function} callback when action is complete.
-
setId (id) view sourceSet current model 's id.
- Parameters
-
- id
-
toJSON () view sourceGet json representation for current model.
- Returns
-
- {Object}
Classes
- Anim
- Anim.Easing
- Attribute
- Base
- Button
- ComboBox
- ComboBox.LocalDataSource
- ComboBox.RemoteDataSource
- Component
- Component.Container
- Component.Controller
- Component.Manager
- Component.Render
- Component.UIBase
- Component.UIBase.Align
- Component.UIBase.Box
- Component.UIBase.Close
- Component.UIBase.Constrain
- Component.UIBase.ContentBox
- Component.UIBase.Drag
- Component.UIBase.Loading
- Component.UIBase.Mask
- Component.UIBase.Position
- Component.UIBase.Resize
- Component.UIBase.StdMod
- Cookie
- DataLazyload
- DD
- DD.Constrain
- DD.DDM
- DD.Draggable
- DD.DraggableDelegate
- DD.Droppable
- DD.DroppableDelegate
- DD.Proxy
- DD.Scroll
- DOM
- Editor
- Editor.Range
- Editor.Utils
- Editor.Walker
- Event
- Event.Object
- Event.Target
- IO
- IO.XhrObject
- KISSY
- KISSY.Defer
- KISSY.Loader
- KISSY.Loader.Module
- KISSY.Loader.Package
- KISSY.Promise
- Menu
- Menu.FilterMenu
- Menu.Item
- Menu.PopupMenu
- Menu.Separator
- MenuButton
- MenuButton.Option
- MenuButton.Select
- MVC
- MVC.Collection
- MVC.Model
- MVC.Router
- MVC.View
- NodeList
- Overlay
- Overlay.Dialog
- Overlay.Popup
- Resizable
- Tree
- Tree.CheckNode
- Tree.CheckTree
- Tree.Node
- Waterfall
- Waterfall.Loader