Hello all,
I have a call to a service that will always return a single object with properties on said object. I have a form bound to a view model. I have a property on the view model that is a reference to the dataSource (service call) so that when I update the object I can call the dataSource.sync() method to save the changes back to the server.
This workflow works well with collections of items (grid). However I am having a tough time figuring out how to bind the form elements to the single object that is being returned by this specific service. the basics are as follows:
Create View Model
Create DataSource, then call .read() method. In the response from the read method I set a property on the viewModel vm.set("myProp", myDS)
Then in my HTML form I would like to bind elements to data from myDS. However if I do something like:
var data = myDS.view()[0];
vm.set("myProp", data);
I of course lose access to the sync() method.
What is the proper way to bind form field values to data from a dataSource object that will only ever have a single object returned?
Hope this makes sense.
Thanks for any and all help.