Two general questions from a relative beginner at this client side SPA stuff. I've had to bridge from a variety of "demos" (for which I'm thankful) and I thank you for any assistance you can provide.
I'm attempting to generate a datasource using sql to a local database which will then be bound to a mvvm listview and rendered via user interaction
Here's the Listview segment I'm using. Note that I've created my own 'accordion like' display mechanism which toggles the "display" which is why it's set to "none" initially in the div.
<div class =
"no-arrow-listview" id = "hoursCategoryAttractionsListview"
style = "display:none;">
<ul
data-role="listview" data-source="
app.GeneralEstateHours_Attractions_DataFile.data"
data-template="hours-template" data-style = "inset"> </ul>
</div>
Here's the code I'm working on to generate the datasource for the listview
app.GeneralEstateHours_Attractions_DataFile = {
data: new
kendo.data.DataSource({
transport: {
read:
function(options) {
app.db.transaction(function(tx) {
tx.executeSql('SELECT * from masterDataTable where
appMapCategoryID = ? ', [ 'Attraction'],
function(tx, result){
var data = [];
for (var i = 0; i <
result.rows.length; i++){
data[i] =
result.rows.item(i);
}
options.success(data);
});
});
}
},
group: {
field:
"appMapCategoryID"
},
sort: {
field:
"appListOrder", dir: "asc"
}
})
};
The issue is that if I omit the "group" filter from the datasource (though I can verify that there is a valid result set returned via the fetch function and some console output listed below) the listview does not display anything. Whereas, if I include the group filter (as I did in the code above) it does indeed render the listview but adds a header to the listview and I don't want to include the "header" that is generated by using the 'group' filter.
If I can't work with the raw return is there away to remove the "listview header" from the generated listview .
app.GeneralEstateHours_Attractions_DataFile.data.fetch(function(){
var test = app.GeneralEstateHours_Attractions_DataFile.data.view();
//alert ("The length of attractions is " + test.length);
for (var i = 0; i<test.length; i++){
console.log("From the Fetch of the new
GeneralEstateHours_Attractions_DataFile Data source we have " +
test[i].title + "image" + test[i].image + " id = " +
test[i].id + "");
}
});