Welcome Guest. Sign in or Signup

2. KnockOut (KO)

Posted on September 26, 2012 0 Comments

How to prevent KO from wrapping certain properties in the data source for notification?

Normally, when you create a KO “view model” through a call like ko.mapping.fromJS(yourData), all the properties in “yourData” will be converted to observable properties (functions) so that KO can notify listeners when their value changes. However, sometimes you may not want KO to “wrap” some properties. You can do so by setting up some mapping […]

Posted on July 5, 2012 0 Comments

How to bind a KO view model data with a datepicker widget?

Binding a KO View model data to a DOM object is very simple and you can do that declaratively. However, to bind to a jquery UI widget, you will have to setup a custom binding and manually transfer data from widget to model data and vice versa on changes. Here is an example of how […]

Posted on July 5, 2012 0 Comments

How to bind KO view model to a jQuery UI Widget’s value?

KO View Model entries can be easily bound to DOM elements declaratively. However, to bind to a jQuery Widget there is a little bit more work to do. You will have to setup a custom binding and manually pass values from the view model to the widget and vice-versa when either one changes. This is […]

Posted on March 27, 2012 0 Comments

How to bind a JSON list to a divs and update the divs automatically when the JSON data changes using KO?

KO lets you specify data binding in the templates declaratively as follows:

Posted on March 26, 2012 0 Comments

How to show a JSON list in a JQuery Accordion using KO?

Here is some sample code:  

Posted on March 21, 2012 0 Comments

How to show a JSON list as a series of divs using KO?

Use the “data-bind” syntax to specify a template for each element in the json list like this: