Well, I've sorted through the Google search and I've sorted through stack overflow and as of yet I don't have a good idea of how to do about this.
I'd like to build a To Do program for the iphone using jqMobi + CSS + HTML 5. I've worked with jQuery a bunch, spent some time with jQuery Mobile and have done tons of css and HTML, (though little work with HTML5). What I need to be able to do is save lists that the user generates when they open up the program.
I'm having no problem dynamically generating and linking pages... but when you open up the program a second time all of the pages (IE To Do Items) that I've generated disappear. I understand that this is because they weren't written in as part of the base program. It occurs to me that the way around this is to save those lists into a file or a DB and then load them when the program starts up.
I've seen documentation to do this using Titanium Studio, (it supports SQL lite) but the generation of pages and general UI suck. Additionally getting an emulator to run from that code has given me a lot of trouble. At least I can say that using appMobi's app to test gives you a decent emulator to work with before you've ported code to a compiled state.
In any case, does anyone know how to set up data persistence (between program restarts) for jqMobi + CSS + HTML 5 with either a DB or file generation?
EDIT x2: Since I've got you on the hook @ian can you take a look a this code and tell me why the $.ui.addContentDiv() doesn't appear to be updating the content? $(#content).append(string); doesn't appear to want to cooperate either. Is there some function I need to call to make it refresh? Stripped it down a bit still having issues. Oddly enough the append to the list works just fine, but when I try to add that div layer it doesn't exist...
code is as follows:
function genPage( id, list, parent ) {
var content = '<div id="' + id + '" class="panel">' + id + '</div>';
var threadLink='<li><a href="#' + id +'">' + id + '</a></li>';
$("#" + list).append(threadLink);
$("#content").append(content);
//$.ui.addContentDiv(id, content, id);
}
Here's my first hack at getting json and cookies to work to whoever might find it helpful. It's just a prototype so it doesn't do much. I've cut out the extra javascript added by AppMobi's dev environment for the sake of simplicity.
EDIT: It looks like JSON works pretty good for a data structure, so long as you're not trying to do anything particularly data intensive. Also it looks like appMobi's AppMobi.cache works pretty well for cookies. Here's my mini script to demo basic cookie manipulation/JSON strings.
code: