Best way to handle model dirtieness in Durandal?

42 views
Skip to first unread message

sobey

unread,
Jan 23, 2015, 4:10:30 AM1/23/15
to duran...@googlegroups.com
Hello,

I have seen questions similar to this one asked several times before in this forum, but still can't figure out a elegant solution to it. So the idea is simple: when user tries to navigate away from a dirty page (which contains user modifications not persisted to DB), prompt the user.

The term dirty in our definition is by model, i.e., a page is dirty iff its model is dirty. So, even user interacts with the page, but as long as the page model ends up being the same as before, the page is not dirty.

So what is the best way to check if a page's model has changed since last load/save?

Thanks!

jmwn...@gmail.com

unread,
Jan 24, 2015, 12:03:52 AM1/24/15
to duran...@googlegroups.com
Have you tried breeze.js?  Not sure if you have that complex a data model, but it's a great way to have entities on the client and track a) whether they have changed from original and b) whether the new values are valid.

Jeremy

Kevin McGee

unread,
Jan 24, 2015, 1:59:07 AM1/24/15
to duran...@googlegroups.com
Seems like a KnockoutJS question... to which there are many, many posted solutions.
KJM
Reply all
Reply to author
Forward
0 new messages