This is a migrated thread and some comments may be shown as answers.

Model object's Dirty Attribute is not Observable

1 Answer 220 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Robert Kaucher
Top achievements
Rank 2
Robert Kaucher asked on 21 Jun 2013, 03:57 PM
I am trying to change the "save" icon on my edit form when an item is flagged dirty as a visual reminder to the user to save her/his work. However it does not appear as though the "dirty" attribute of the Model object is observable. Its value never changes in the UI when I bind to it nor does it ever notify when I bind to the "change" event.

I know that I can do what I want by binding to "change" but it seems silly to have to observe the entire object and have an event that fires with every change and for any change when a property already exists that purports to contain the desired information that I am after.

Or am I just missing something?

http://jsfiddle.net/RobertKaucher/Fyrs6/

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 25 Jun 2013, 02:14 PM
Hello,

Yes, that is correct. The dirty field is not and should not be observable and the event should not be triggered when it is internally changed. You should bind a handler to change event in order to add the flag. If you wish to be notified only the first time which is basically when the dirty field is changed, then you can bind a one time handler with the one method.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
MVVM
Asked by
Robert Kaucher
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Share this question
or