I am trying to enable a save button based on the change events of various UI elements.
The save button needs to be enabled if any of the following happens 1) Input data changes 2) Or if the cities of the user list size changes.
How do I track the list size change event ? and How do I enable the save button for both the events in knockout ?
You should use a computed
this.canSave = ko.computed(function() {
return this.observableOne() === "foo" && this.observableTwo() === "bar";
}, this);
edit: Or use dirty logic like http://www.knockmeout.net/2011/05/creating-smart-dirty-flag-in-knockoutjs.html