09-17-2013 01:11 PM
I think I've solved most of my problems with getting my data to be usable in various functions etc... but by problem now (which may have been the fundamental problem all along) is related to the asychronous nature of Web Database processing.
I get my markup back as a <div> with all the 'data-bb-type' etc. attributes, but based on the "alert" statements I have sprinkled throughout my code, the database results are processed after the "onscreenready" event has finished and "ondomready" has started.
I know that if you're going to generate markup for use with BBUI.js, it has to go into the "screen" before the "screen" is passed to BBUI.js so BBUI can do all it's fancy stuff to it.
I've tried to make sense of it, but it eludes me. Perhaps someone could point me in the right direction for a good tutorial that explains in some clear way what is going on behind the scenes and then I guess I'll have to rip my code apart and put it back together... or at least call functions in a different way or from a different place, or use callbacks more liberally (I'm not exactly clear on use of callbacks either).
Solved! Go to Solution.
09-18-2013 10:57 PM - edited 09-18-2013 11:02 PM
BUMP. I've seen easy-to-understand code for reading SQLite... I've seen easy-to-understand code for interacting with existing BBUI.js objects... I haven't yet found any sample code that hits a SQLite database for a given BBUI "screen" and then fills that screen with objects derived from the SQLite database result. Is there any sample code that fetches the data via SQLite query and processes it into BBUI.js-compatible markup all within the 'onscreenready' event?
Is it possible that I should perform all my 'bulk' queries in the initApp function (pull all the data from all the SQLite tables into objects, ready to process) when the app launches, then in "onscreenready" just process the object into the markup?
I think that approach would work, but I think I'm right in trying to avoid an approach that is "top heavy" and I think I want to rule out other (what I think are very likely) more correct approaches before I resort to basically bringing the entire SQLite database into memory and keeping it there / interacting with objects AND the database at every turn.
09-21-2013 02:38 PM
09-22-2013 12:13 AM