- This topic has 5 replies, 2 voices, and was last updated 14 years ago by Albatros78.
-
AuthorPosts
-
skashiMemberHi 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)?
Albatros78ParticipantHello 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
Albatros78ParticipantHello 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
skashiMemberI 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
Albatros78ParticipantHello everybody,
Hi WayneMaybe 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.
Albatros78ParticipantVersion 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. -
AuthorPosts