I found similar posts but nothing that really addresses the concern. Basically want to implement Cancel on a ViewModel. I've created a fiddle http://jsfiddle.net/yN5Cd/1/
Pretty simple, just create a model and a schema. Create a datasource setting the schema. Add the model to the datasource and call sync(). Bind the first and only item in the datasource to a template.
What I really want to is to able to cancel changes on the item in the datasource. I do have a Cancel button and it calles cancelChanges on the datasource but results in a an empty dataSource.
I don't see why it's so much different than editing a datasource bound to a listview. The cancel works great when the datasource is populated using the transport url. But when I add an item in the javascript, the datasource removes it as soon as cancelChanges is called.
I would expect the original state of the model to be restored and the model to remain in the datasource.
Thanks,
Pretty simple, just create a model and a schema. Create a datasource setting the schema. Add the model to the datasource and call sync(). Bind the first and only item in the datasource to a template.
What I really want to is to able to cancel changes on the item in the datasource. I do have a Cancel button and it calles cancelChanges on the datasource but results in a an empty dataSource.
I don't see why it's so much different than editing a datasource bound to a listview. The cancel works great when the datasource is populated using the transport url. But when I add an item in the javascript, the datasource removes it as soon as cancelChanges is called.
I would expect the original state of the model to be restored and the model to remain in the datasource.
Thanks,