So in my view file a have a list of entries and my goal is to navigate to a screen which shows details about those entries when you click on them. This is the code for the listview:
<ul id="mainListView" data-role="listview" data-style="inset"
data-click="app.viewModels.dataViewModel.navigateToEntry">
</ul>
And this is the method it points to in the viewModel:
navigateToEntry: function(e) {
app.mobileApp.navigate("#views/entryView.html?entno=" + e.dataItem.entno);
}
The problem is that the first time I click on it I get this:
"Uncaught TypeError: Cannot read property 'entno' of undefined"
The 2nd, 3rd and so on time it's working fine, but the 1st one is always throwing this error. Any ideas how to fix it? Thank you!
Please, check this code:
navigateToEntry: function(e) {
if(e.dataItem !== undefined){
app.mobileApp.navigate("#views/entryView.html?entno=" + e.dataItem.entno);
}
}
Does now first click work or does it not do anything?