问题
How to load data from database on load of the application? How to push data to database? The sample given by IBM Worklight helps to load data from JSON store, but how to use HTTP Adapter to fetch data and load?
回答1:
Read the documentation and look at the JSONStore getting started modules and code samples.
How to load data from database on load of the application?
Use load. You can also do it with WL.Client.invokeProcedure or jQuery.ajax and then call add with the response data.
How to push data to database?
Use push or get the documents with local-only changes with getPushRequired and use WL.Client.invokeProcedure or jQuery.ajax to send data back to the backend.
All the methods linked above have examples. You should be able to figure out how to adapt those examples to your needs.
来源:https://stackoverflow.com/questions/16788577/ibm-worklight-json-store-with-sync-using-http-adapater