new observableArray(arr)
Observable Array class
Parameters:
| Name | Type | Description |
|---|---|---|
arr |
Array | Array data to observe |
Extends
Members
-
_computedFn
-
Save a reference to the function of computed value
- Inherited From:
-
_newData
-
Get and set underlying without side effect
- Inherited From:
-
_oldData
-
Old data of the observable object, internal use
- Inherited From:
-
bindingNodes
-
Save a list of input/textarea element. This is helpful for validation and error handling
- Inherited From:
-
delayTime
-
Delay time
- Inherited From:
-
dependencies
-
All references to observable objects what depend on this
- Inherited From:
-
isValid
-
Is valid state, default be null, not validated state
NOTE: Null is different from valid and invalid state- Inherited From:
-
rules
-
All validation rules
- Inherited From:
-
subscribers
-
Subscribers that listen to data changes
- Inherited From:
Methods
-
add(item, index)
-
Add an item into an observable array
Parameters:
Name Type Description itemObject Item to add
indexNumber Index to add
-
delay(time)
-
Set delay time of notifying changes
Parameters:
Name Type Description timeNumber Delay time (miliseconds)
- Inherited From:
-
notify(listItem, item [, index] [, action])
-
Notify changes to subscribers
Parameters:
Name Type Argument Default Description listItemArray | Object Newest data underlying observable
itemObject Item changed
indexNumber <optional>
null Index of item changed
actionString <optional>
"render" Action to notify to subscriber
- Overrides:
-
push(item)
-
Push an item into an observable array
Parameters:
Name Type Description itemObject Item to add
-
remove(item)
-
Remove an item from the observable array
Parameters:
Name Type Description itemObject Item to be removed
-
removeAt(index)
-
Remove an item from the list
Parameters:
Name Type Description indexNumber Index of removed item
-
setDependency(dependency)
-
Set a dependency
Parameters:
Name Type Description dependencyhtml.observable Dependency of this data
- Inherited From:
-
subscribe(observer)
-
Subscribe change to observable data. Whenever the underlaying data changes, it trigger all subscribed functions
Parameters:
Name Type Description observerfunction Observer
- Inherited From:
-
update(item, index)
-
Update an item of the list
Parameters:
Name Type Description itemObject New item to update
indexNumber Index of the item
-
validate()
-
Validate data against validators
- Inherited From:
-
validators(rule)
-
Register validation rule for html.observable
Parameters:
Name Type Description rulefunction Validation rule function
- Inherited From: