MVC.Collection
Class
Attributes
- comparator {Function} Comparator function for index getter when adding model.
- model {MVC.Model} Model constructor with in current collection.
- models {MVC.Model[]} Model list.
- parse {Function} Get structured data from raw data returned from server.
- sync {Function} Sync function to sync data with server.
- url {String|Function} Get url for sending data to server.
Methods
- add (model, opts) Add a model to current collection.
- at (i) Get model at specified index.
- create (model, opts) Add a model to current collection by provide json data.
- getByCid (cid) Get model instance by client id.
- getById (id) Get model instance by id.
- load (opts) Initialize model list by loading data using sync mechanism.
- remove (model, opts) Remove an existing model from current collection.
- sort () Sort model list according MVC.Collection#comparator.
- toJSON () Get json representation of this collection.
Attributes Detail
-
comparator {Function} Comparator function for index getter when adding model. default to append to last of current model list.
-
model {MVC.Model} Model constructor with in current collection.
-
models {MVC.Model[]} Model list.
-
parse {Function} Get structured data from raw data returned from server. default to return raw data from server.
-
sync {Function} Sync function to sync data with server. Default to call MVC.sync
-
url {String|Function} Get url for sending data to server.
Methods Detail
-
add (model, opts) view sourceAdd a model to current collection.
- Parameters
-
- model {Object|MVC.Model} Model or json data to be added.
- [ opts ] {object} Add config
- opts.silent {Function} Whether to fire add event.
-
at (i) view sourceGet model at specified index.
- Parameters
-
- i {Number} Specified index.
-
create (model, opts) view sourceAdd a model to current collection by provide json data.
- Parameters
-
- model {Object} Json data represent model data.
- opts {object} Create config.
- opts.success {Function} Callback when create is successful.
- opts.error {Function} Callback when error occurs on creating.
- opts.complete {Function} Callback when create is complete.
- opts.silent {Function} Whether to fire add event.
-
getByCid (cid) view sourceGet model instance by client id.
- Parameters
-
- cid {String} Client id auto generated by model.
-
getById (id) view sourceGet model instance by id.
- Parameters
-
- id {String}
-
load (opts) view sourceInitialize model list by loading data using sync mechanism.
- Parameters
-
- opts {object} Load config.
- opts.success {Function} Callback when load is successful.
- opts.error {Function} Callback when error occurs on loading.
- opts.complete {Function} Callback when load is complete.
-
remove (model, opts) view sourceRemove an existing model from current collection.
- Parameters
-
- model {MVC.Model} Model to be removed.
- [ opts ] {object} Remove config.
- opts.silent {Function} Whether to fire remove event.
-
sort () view sourceSort model list according MVC.Collection#comparator.
-
toJSON () view sourceGet json representation of this collection.
- 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