Hi - I think this is a simple task, but I haven’t found a simple solution.
I have a row of objects. You can edit an individual object and the bindings show you real time updating. That’s cool - however, what if I DON’T want to show the updates until the user Saves the object?
I’ve seen stuff from googling on BufferedProxy but that seems like a TON of work just to hide the state change until it’s committed.
I also thought about trying to duplicate/copy the object, modify it, then save it overtop of the original object.
I’d like to know what others would suggest in trying to disable the auto-binding UI.
Thanks tristanpendergr - that would require creating new properties for each of the Object/Model properties. I was hoping for a non-duplicating way to solve this issue.
You can do exactly the same thing in a controller as well. All you have to do in your template is prefix the binding with buffer e.g. {{buffer.someBufferedComponentParam}}
Just wanted to say this is a great question. People get so caught up in the magic of data binding, that they totally miss the fact that it can result in some truly crap UX: one being adding non-persisted items to a collection, the other being showing a collection item in mid edit before anything has been saved. I think its the result of over-simplified example “apps” like TODO MVC. Starred for interest.
Buffered Proxy pattern is one we started to adopt as well within our app. And I agree with @uberllama it’s often overlooked and attempts to skirt around the issue typically results in some ugly hacks. BufferedProxy is by far the more elegant solution available.
The Buffered Proxy hides the changes until you save. But then as soon as the save starts the UI reacts to the now changed model, and you have to resort to the ugly filter hacks you are doing.
What would be ideal, is if there was a way to use the BufferedProxy, then take the buffered changes, and apply those ( serialize that and send it to server ) and then AND ONLY when the save promise returns , so apply those changes to the model.
This is what the original question asked as well.
So far, I have not seen anything that does that. But I am going to work on it.