Results 1 to 8 of 8
  1.    #1  
    I've been trying to populate a List Widget in one of my scenes with records from my html 5 database and I just can't get it to work. I'm attempting to call it in activate since I just want that scene to display all records. Can anyone post a code example on how to do this in Ares?
  2. #2  
    You should have to do anything special, regardless if the data comes from an html5 database or a cookie. As long as your data objects are set properly, you shouldnt have a problem.

    Are you using any item or list templates that may not be set properly?

    Five or More for the Palm Pre and Palm Pixi
  3.    #3  
    I know 'I shouldn't have a problem' if I knew how to do this properly and I'm sure its a very simple procedure for a jacaScript programmer, but I'm new to javaScript. This is why I was asking for a quick code example so that I could compare it to what I have.
  4. #4  
    Forgive me for not having any code in front of me, so I will just use the palm docs according to this:

    Mojo.Widget.List - Palm Developer Center

    There is a pretty clear cut example in the instantiation part. If you want to post up your code, that would be pretty helpful for me. However, I am wondering 1 of 2 things.

    1. Are you using any templates? You may not be referencing them properly.
    2. You may not be parsing the data from the database into an object properly.

    Five or More for the Palm Pre and Palm Pixi
  5. DrewPre's Avatar
    818 Posts
    Global Posts
    829 Global Posts
    you'll have a function to query the database... say....this.queryDB...It's callback function will look like the following....

    SceneAssistant.prototype.queryDataHandler = function (transaction, results) {
        for (a=0;a<results.row.length;a++){
           row = results.row.item(a);
           // this next line is optional. Use only if you need to add additional fields/data
           row = {column1: row.col1, column2:row.col2,  additional-column3:"add-data3"};
    This assumes that a) you've properly initialized your this.listModel and b) that you've correctly setup your this.queryDB function to pull data from your database.

    If you haven't done a) ... then put the following in the setup of your scene-assistant.jsjsjs $file$....

    this.listModel  = {items: [] };
    If you haven't done b) look up the reference info for Mojo.Service.Request on Personally, I prefer and their examples of how to access html5 dbases. Particularly the examples on handling Multiple Rows in a single transaction [reducing disk access overhead] and non-anonymous callbacks.

    Keep in mind that I have not tested the code above.... It is just off the top of my head... test it and customize it to your needs.
    Last edited by DrewPre; 05/12/2010 at 04:26 PM.

    Palm Pre Backup Utility...done!
    Locate Pre....done!
  6.    #6  
    Thanks Drew! I wasn't innitializing this.listModel. I really appreciate you taking the time to post that walk through. I'm still trying to learn this stuff while building my first app. It's really coming together though and I hope to have it out very soon.
  7. DrewPre's Avatar
    818 Posts
    Global Posts
    829 Global Posts
    I've was where you are last fall. I learned everything thru trial and error, google, and a few individuals from this community!

    Good luck on your app.

    Palm Pre Backup Utility...done!
    Locate Pre....done!
  8. #8  
    Hi. I'm pulling my hair over this one and have precious little hair left so it's not a good thing.

    Here's my code:

    		var db = openDatabase(dbname, dbversion);
    var sql = "SELECT * FROM 'my_table'";
    db.transaction(function(transaction) {
      transaction.executeSql(sql, [],
                             function(transaction, results) {
    		if( results.rows.length > 0 ) {
    	     for (a=0;a<results.rows.length;a++){
           row = results.rows.item(a);
           row = {id:, pubmedID: row.mypubmedID, title: row.mytitle, authors: row.myauthors, source: row.mysource, pubdate: row.mypubdate};
    The Ares Log viewer says there is a problem with the line

    Uncaught TypeError: Cannot read property 'items' of object

    Now I have checked and rechecked that under the modelName property of the list in Ares, it is
    and the itemsPropertyName is

    I have instantiated lists using array data eg
    this.listModel.items = newArray;
    without problem

    so I don't know why this error is cropping up
    Check out my My Medical webOS Apps
    Featured free apps: DrugView | Eponyms | eMed | Dosecalcfree | Beeb News

Posting Permissions