Modify Validate Observable Of Editable Table In Knockoutjs
I'm actually doing my project the editable grid, my data comes from the JSON and parsed to dictionary to have key and value and display on the table. I have one more column to have
Solution 1:
The first problem was value needed to be an observable so that when it was modified in the textbox, the label is also updated.
The next is isEditing needed to be an observable so that it can be switched from edit mode to display mode.
result.push({
key: key,
value: ko.observable(dictionary[key]),
isEditing: ko.observable(false)
});
<inputdata-bind="value:value,visible:isEditing()" /><labeldata-bind="text:value,visible:!isEditing()" />
The last problem was the click functions were invalid and not even added to the model.
edit: function (item) {
item.isEditing(true);
},
cancel: function (item) {
item.isEditing(false);
}
<a href="#" data-bind="click: $root.edit">Edit</a>
<ahref="#"data-bind="">Apply</a><ahref="#"data-bind="click: $root.cancel">Cancel</a>
Post a Comment for "Modify Validate Observable Of Editable Table In Knockoutjs"