kendoMobileListView dataItem undefined

2 posts, 0 answers
  1. Gerhard
    Gerhard avatar
    7 posts
    Member since:
    May 2013

    Posted 08 Jul 2013 Link to this post

    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
  2. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 09 Jul 2013 Link to this post

    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.
Back to Top