Object JavaScript – Dynamic UI With MVVM Using ObservableArray in Knockout.js
In our previous post Dynamic UI Using Observables with MVVM Using Knockout.js, you learned how you get started with Knockout.js and how you can detect and respond to changes on one object using observables.
Knockout.js simplifies JavaScript UI by applying the Model-View-ViewModel pattern.
Now if you want to detect and respond to changes of a collection of things, you can use an observableArray
. An observableArray tracks which objects are in the array, not the state of those objects.
An observableArray
tracks which objects it holds, and notifies listeners when objects are added or removed.
You can make the items themselves observable if you wish, but we’ll start with a basic observableArray.
Continue reading “Object JavaScript – Dynamic UI With MVVM Using ObservableArray in Knockout.js”