Note that there are some explanatory texts on larger screens.

plurals
  1. POTable generation through JavaScript
    primarykey
    data
    text
    <p>I was using SQLite in html5 and it worked fine. But the thing was the rows which I was displaying in the page itself were not looking that good. I used innerhtml for displaying the rows as inserted by the user. Here is the script</p> <pre><code>function showRecords() { results.innerHTML = ''; // This function needs a single argument, which is a function that takes // care of actually executing the query db.transaction(function(tx) { tx.executeSql(selectAllStatement, [], function(tx, result) { dataset = result.rows; for ( var i = 0, item = null; i &lt; dataset.length; i++) { item = dataset.item(i); results.innerHTML += '&lt;li&gt;' + item['lastName'] + ' , ' + item['firstName'] + ' &lt;a href="#" onclick="loadRecord(' + i + ')"&gt;edit&lt;/a&gt; ' + '&lt;a href="#" onclick="deleteRecord(' + item['id'] + ')"&gt;delete&lt;/a&gt;&lt;/li&gt;'; } }); }); } /** * Loads the record back to the form for updation * * @param i */ function loadRecord(i) { var item = dataset.item(i); firstName.value = item['firstName']; lastName.value = item['lastName']; phone.value = item['phone']; id.value = item['id']; } /** * Delete a particular row from the database table with the specified Id * * @param id */ function deleteRecord(id) { db.transaction(function(tx) { tx.executeSql(deleteStatement, [ id ], showRecords, onError); }); resetForm(); } </code></pre> <p>So in the code <code>showRecords()</code> method, I have hard coded the data to be displayed. What I want is, that data should be displayed in proper tabular format. I know I have to create elements in JavaScript for dynamic table generation but I am unable to do so and also to display the contents inside table.<br> Everytime user fills up the form and clicks insert button, insert statement gets executed and then <code>showRecords()</code> method is invoked. I am not able to figure out the proper soluton.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload