I am working over a Windows 8 metro app using(HTML 5, JavaScript) and want to know how i can bind data from the SQLite tables in my dropdown list, please guide or suggest with some source codes. I am using the below mentioned approach, is there any other way to do this job in win metro app
function getcategories() {
SQLite3JS.openAsync(dbPath).then(function (db) {
db.allAsync('SELECT * FROM dbCategorymaster where isActive=' + IsActive + ' order by [order]')
.then(function (rows) {
var str = "";
for (var i = 0; i < rows.length; i++) {
str = str + '<option value=' + rows[i].id + '>' + rows[i].category + '</option>';
}
var ddlcategory = document.getElementById("drpCategory");
ddlcategory.innerHTML = '';
ddlcategory.innerHTML = str;
db.close();
})
});
}
What kind of component do you use to access SQLite?
So for I haven’t come across any way to declaratively bind options of a select tag.
You could either use a ListView and its itemDataSource (as provided by our SQLite component) or programmatically fill the options like described in this thread.