facebook

Binding local data to listItems

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #312466 Reply

    skashi
    Member

    Hi there

    I am trying to populate a bunch of listItems from local storage. I can traverse through the local storage:

    db = openDatabase("attorneys", "1.0", "Attorney Database", 200000);
          db.transaction(function(tx) {
            tx.executeSql("SELECT * FROM m1_attorney", [],function(tx,results){
              listText = '';
              for (var i=0; i<results.rows.length; i++) {
                var row   = results.rows.item(i);
                alert('first_name='+row.first_name);
                /* CREATE LISTITEM CODE HERE */
            }, function(tx,Error){});
          })

    This does alert the first name from local storage but how do I create a listItem from Javascript (see where my comments are)?

    #312477 Reply

    Albatros78
    Participant

    Hello skashi,

    Good question…. very interesting.

    In your example, I can suppose that you have differents records into your local db.
    Please how have you populate the db to add these records ?

    Have you used a similar function to

    tx.executeSql(“INSERT INTO ” + MyTable + ” (firstname,lastname,phone,email) VALUES (?,?,?,?) “,[‘Travolta’,’John’,’0102030405′,’john@travolta.net’],function(tx,result)

    and one function by record !!!!! , or do you have other solution faster… to pouplate the db with many records

    Many thanks for your help

    #312520 Reply

    Albatros78
    Participant

    Hello skashi

    I found one solution to populate the local db.

    But do you have found solution to create the listitem from the data.

    A listitem (sorted) like the list from the contact iPhone icon would be very nice.

    Hello Forum guys ….any input will be appreciate

    #312521 Reply

    skashi
    Member

    I haven’t been able to find a solution to create the listItem from the localStorage data. That is what I was hoping for some assistance in this forum.

    I can create a listItem by copying the html structure through jQuery but it does not come out well. I’ll post you the code, maybe you will have better luck with it.

    I will post the code tomorrow as it is on my work pc.

    Regards
    Sksahi

    #313332 Reply

    Albatros78
    Participant

    Hello everybody,
    Hi Wayne

    Maybe we are several to ask this question. Me too

    How to pouplate a list after reading infos from a local DB (or why not remote DB)

    I post here a zip file which is a sample to create and read the local DB

    But I would like populate the list item inside this project and add the firstname of each record into each listitem

    Does anyone have a solution to do that ?
    Any feedback would be very nice.

    Many thanks for your contribution

    Attachments:
    You must be logged in to view attached files.
    #313333 Reply

    Albatros78
    Participant

    Version of my issue.

    In this file now, the results oof sql request is displayed into the web page.

    Need now to populate the listem with each item read from the DB

    Howwwwwwwwwwwwwww ???

    Here my 2 pictures, are:

    Before the reading DB

    when the reading is ok and results displayed but NO Into listems

    Again many thanks for you help and inputs

    Attachments:
    You must be logged in to view attached files.
Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Binding local data to listItems

You must be logged in to post in the forum log in