Skip to main content

Posts

Showing posts with the label Knockoutjs

Knockoutjs check/uncheck all checkboxes using header checkbox.

While working with Knockoutjs ViewModel, if we implement the select all checkbox feature using traditional JavaScript/JQuery, then in such scenario we can see that Knockoutjs observable property is not getting updated when all checkboxes are checked/unchecked. To handle such situation, we can create Knockoutjs computed property ( with read/write ) and can bind it to header checkbox and there is no need to use the traditional JQuery. Below is the sample code to demonstrate the same: As usual create the Knockoutjs ViewModel and then bind it to UI using ko.applyBindings function CheckViewModel() {     var self = this ;     self.Countries = ko.observableArray(                                                 ...