Each row will have an 'Edit' button. On clicking this,
It should fill the row values in the respective textboxes below the table. eg: 'productName' will fill in txtName, etc.
Editing the text in the textbox will reflect the change in the table.
But the foll. code is not working :
<td>
<button data-bind="click: $parent.editProduct">Edit</button>
</td>
function Product(Name,Qty) {
pname = ko.observable(Name);
qty = ko.observable(Qty);
}
var ViewModel = function () {
var self = this;
self.products = ko.observableArray([{ pname: 'Mobile', qty: 5 },
{ pname: 'Car', qty: 1}]);
self.SelectedItem = ko.observable(new Product());
self.editProduct = function (item) {
self.SelectedItem(item);
};
};
ko.applyBindings(new ViewModel());
attr: {disable:...}, knockout provideddisableandenablebinding out of the box. knockoutjs.com/documentation/disable-binding.html