5 בDecember 2011

KnockoutJS–Dependencies One of the things we’ll probably need is to be able to have dependency tracking in our bounded data. For example – if we have a customer’s list, we’d like to see the customer’s orders whenever we click on a customer. In this post I’ll demonstrate how to do it using the dependentObservable function of KnockoutJS Let’s look at the following JavaScript code: var viewModel = { ...
no comments

KnockoutJS–Event binding

4 בDecember 2011

KnockoutJS–Event binding After binding the data into our page, we wish to be able to create an interactive page. This means that we want to be able to add some behavior to our view-model, triggered by an event on the page. (A button being clicked for example). The click binding You can bind to the click binding the same as you bind to the value only that now it’s expects a parameter-less function. In case you have a method that expect parameters you can have a binding expression like that: ...
one comment


1 בDecember 2011

KnockoutJS–Templates After being introduced to KnockoutJS concept and go to know the basics of data-binding with Observable and  observableArray, let’s move on to how to work with templates and our collection to them. In this post I’ll explain how to bind a collection with template. Prerequisites Now, adding to KnockoutJS Prerequisites (jQuery 1.4.2 and above)  you’ll need another Javascript library: jQuery.tmpl . You can download this version or visit the project page for latest version. HTML as script The templates are HTML content written inside of a script tag,...
one comment