Saving Information in Dashcode for app closing/syncing information
I am VERY new app development, Java, and databasing! I am having a hard time understanding what I can do to save information that has been entered into text fields.
Basically, if a user enter info in to let's say "textField01" - Then another user on another device needs to see that information...or user1 closes the app/browser and needs "textField01" to be populated with that he entered before.
I don't know if there is a need for a "save" or "sync" button but I have one ready to use if you could also suggest a clickHandler for that and what not. If it was done that way, would I need a "load" button as well?
I think the best solution is if someone could direct me to an awesome tutorial dealing with these kinds of situations - or if there is some source code I can see and have explained in detail somewhere.
Every other aspect of my web app works! It's just if you enter in the info and exit the app, your info is gone! Or, if some开发者_StackOverflow中文版one else needs to see it it's blank!
HELP PLEASE! and obviously...keep it simple.
There is a book out on the subject now Dashcode for Dummies (no implication that you are a Dummy ;-)) here. I have not looked at so please check it yourself to make sure it is suitable.
A simple way to save any values between session is the setPreferences, so
widget.setPreferenceForKey(4,"ratePrecision");
will save the variable ratePrecision with a value of 4 and
var ratePrecisionx = widget.preferenceForKey("ratePrecision");
will retrieve it The values are stored in a plist in the users home folder.
This works and preserves values between session but obviously is only really useful for a small amount of data. For more complex and larger amount you need to look at adding a data source which can be an xml file or sqlite database etc. There are code stubs for getting and setting data sources in the Dashcode library
精彩评论