Search code examples
jaydata

How do I get the save results from a JayData saveChanges() call?


In JayData, how do I find out how my saveChanges() call went? In Breeze, the save command returns a saveResults object. Is there anything equivalent in JayData?


Solution

  • Disclaimer: I work for the JayData project

    Unfortunately individual results of the batch operation are not accessible in the current version when using context.saveChanges(). In general you'll be able to receive the status of the results through the then() and fail() branches promise handlers (jQuery required).

    You'll have more detailed info about the exception result (error details) if you are using the instance save(), remove() etc methods as you'll get detailed error response in the fail() branch.

    If the result contains entity updates then those updates are automatically merged into the live entity instance - both with saveChanges() and instance.save().

    If you need to process the protocol result use context.prepareRequest() to intercept the http communication.