ZiadJ / knockoutjs-reactor

Recursively tracks changes within a view model no matter how deeply nested the observables are or whether they are nested within dynamically created array elements.
Other
74 stars 22 forks source link

How can we reset it? #32

Closed Syltty closed 8 years ago

Syltty commented 9 years ago

Sorry I'm new to knockout. I have a view in read mode and an Edit button. When the user clicks it then I display an Edit view, start to watch my viewmodel for change and display a Cancel and a Save button. If the user click the Cancel button I would like to reset the watching. How could it be possible? Thank you!

ZiadJ commented 8 years ago

If your viewmodel only gets modified when you press Save you only need to wire a method to the Cancel button that sets the text back to that in its viewmodel. If it was set to update on the fly as you type then there's an option oldValues(see source code documentation), which allows you to keep track of old values as well. Hope that answers your question.