Model object's Dirty Attribute is not Observable

2 posts, 0 answers
  1. Robert Kaucher
    Robert Kaucher avatar
    56 posts
    Member since:
    Oct 2010

    Posted 21 Jun 2013 Link to this post

    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/
  2. Daniel
    Admin
    Daniel avatar
    2231 posts

    Posted 25 Jun 2013 Link to this post

    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!
Back to Top