lundi 22 juin 2015

unable to display SQLite data as listview using phonegap

The function get_list here is able to execute the query but not able to display the rows.

function get_list()
{
    db = window.openDatabase("timeDB", "1.0", "time", 200000);
    db.transaction(populateDB, transaction_error, populateDB_success);


    function populateDB(tx)
    {


        tx.executeSql("SELECT (date) FROM time", [], function (tx, res)
        {


            var len = result.rows.length;

            if (len > 0)
            {

                for (var i = 0; i < len; i++)
                {
                    var a = results.rows.item(i)['date'];
                    document.getElementById("output").value = a;
                }

            }



        });

    }

    function transaction_error(tx, error)
    {
        alert("Database Error: " + error);
    }

    function populateDB_success()
    {



        alert("Successfully inserted");

    }


}

The function get_list is working when the code to display the rows is removed. I have already lookedn through other examples

Aucun commentaire:

Enregistrer un commentaire