I am new to Knockout.js I have 3 fields in the UI . Product value. Quantity Total
Everything works fine with the computed observable and could save the data.The total will be changed in the backend for some business reasons.
While retrieving the data back,I need to show the total from the DB as initial value,but when the user chnages the product and value ,the original computed function should be used.
I tried bindingHandlers but could not get it right..
Help would be highly appreciable.
var TsFoundationDeviceModel = function(product,qty,total) {
var self = this;
self.product = ko.observable(product);
self.quantity= ko.observable(qty);
self.computedExample = ko.computed(function() {
return self.product() * self.quantity() ;
});
}
<input name="product" data-bind="value:product">
<input name="value" data-bind="value:value">
<input name="total" data-bind="value:computedExample"/>