1

I am in early stages of learning Ember.js. Particularly I am interested if it can tell me the 'deltas' that have been applied to the Model due to the user modifications/additions via the UI

I need to allow users to change values of checkboxes, lists, edit boxes and the Data grid (EmberTable ) -- and then capture those changes in a uniform widget-independent fashion (incrementally every 5-6 seconds) and then send them back to the backend or the the in-browser database (taffyDb) if browser is offline.

For example Delta of the Model means: My model has a list of 5 elements that's represented in the view as a List. A user clicks an 'add' button to add another entry to the list. That change Ember propagates back to the Model. So now the model contains the list of 6. What I am looking for is the automatic framework function call (or something) that let's me know exactly the value that was added by the user (or changed in case I had a text box)

I am looking for pointers to ember documentation/samples that at least do something similar -- to see how much support this framework provides vs how much I would have to build myself

V P
  • 845
  • 10
  • 28
  • what do you mean by delta? – Mudassir Ali Sep 02 '13 at 06:12
  • added the clarification into the question – V P Sep 02 '13 at 20:18
  • you can know them using hooks, If it is an array then we have arrayDidChange, arrayWillChange methods with appropriate parameters which lets us know exactly the value that has been added/removed from the list, but when it comes to the text box case, I think we might need to peek into the source code. I will post a working jsfiddle once I get a chance... – Mudassir Ali Sep 03 '13 at 06:43
  • Thank you for the pointer. it appears that those methods provide only the last change. So if array had 5 and user added 1 and then removed another the first item, I will get index of the removed item, but not the reference to the previous operation (the addition) -- am I understanding this right ? I am looking for an aggregate 'delta' result, ideally -- so that I do not have to maintain the delta management myself. – V P Sep 04 '13 at 05:46
  • As far as I know, you can know both the added & removed element, just play around with those hooks, http://stackoverflow.com/questions/10390050/how-can-i-observe-array-changes-and-see-which-new-element-is-added – Mudassir Ali Sep 04 '13 at 06:01

0 Answers0