This is a migrated thread and some comments may be shown as answers.

kendoMobileListView dataItem undefined

1 Answer 78 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gerhard
Top achievements
Rank 1
Gerhard asked on 08 Jul 2013, 03:17 PM
Not sure if this forum is the right place for my question, but maybe another Icenium user already had the same challenge:

I use kendoMobileListView in a couple of places in my app. For some reason dataItem returns undefined in one particular place:

function showAllBikesInBikeSelection() {
 $("#selBikes").kendoMobileListView({
  dataSource: kendo.data.DataSource.create({data: model.bikersArray}),
  template: $("#choosebikeTemplate").html(),
  click: function(bItem) {
   model.current = bItem.dataItem; // UNDEFINED ?
   location.href = "#tabstrip-map";
  }
 });
}

I cannot figure out the difference to the other ListViews where dataItem uses to be the item the user clicked on.

Any help is appreciated.

Kind regards,
Gerhard

1 Answer, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 09 Jul 2013, 12:48 PM
Hello Gerhard,

You can try to change your data source initialization by newing up a DataSource as outlined in Kendo's examples:

function showAllBikesInBikeSelection() {
 $("#selBikes").kendoMobileListView({
  dataSource: new kendo.data.DataSource({data: model.bikersArray}),
  template: $("#choosebikeTemplate").html(),
  click: function(bItem) {
   model.current = bItem.dataItem; // should be your data item
   location.href = "#tabstrip-map";
  }
 });
}

 

Hope this helps,
Stefan Dobrev
Telerik

Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
Tags
General Discussion
Asked by
Gerhard
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Share this question
or