data binding - Set isActive in view model then checkbox is checked -
I need a true or false set for each in the model of the view, check box is checked in the client table or Not checked. I can not apply data-bind with changes. Disabled value
Typecript View Model:
Class ModelViewModel {products: KnockoutObservableArray & lt; Products & gt ;; Manufacturer () {products = ko.observableArray & lt; Product [] & gt; (); }} Typuscript Model:
Product of the Category {Name: Knockout Observe & lt; String & gt; IActive: Knockout Observeable & lt; Boolean & gt ;; } Constructor () {this.name = ko.observable & lt; String & gt; (); This.isActive = ko.observable & lt; Boolean & gt; (); } HTML:
& lt; Table class = "table-table-range" & gt; & Lt; Tbody data-bind = "foreach: vm.products" & gt; & Lt; TR & gt; & Lt; Td> & Lt; Input type = "checkbox" id = "chekBx" data-bind = "value: active" & gt; & Lt; / Td> & Lt; Td> & Lt; Span data-bind = "text: name" & gt; & Lt; / Span & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt;
All you have to do is separate bindings, checked Need to use value instead.
Comments
Post a Comment