$(document.body).kendoTouch() only works in initial view on iPhone

4 posts, 1 answers
  1. Dean
    Dean avatar
    73 posts
    Member since:
    Oct 2012

    Posted 19 Jun 2013 Link to this post

    Hi,

    I am trying to listen to a swipe event across my entire Kendo mobile application. My best attempt is as follows:

    $(document.body).kendoTouch({
        enableSwipe: true,
        minXDelta: 20,
        swipe: function(e) {
            console.log("swipe " + e.direction);
            alert("swipe " + e.direction);
            if(e.direction == "right") {
                if(app.pane.history.length > 1){
                    app.navigate("#:back");
                }
            }
        }
    });

    This works in the graphite simulator and on android devices. However, on an iPhone the event is only fired on the initial view before navigating anywhere. After navigating to another view it no longer fires, even when returning to the initial view. I figure the event handler is dropped after the DOM is modified but it's hard to debug on the iPhone.

    I did get this working by rebinding this event handler to the body every time the application viewShow event fired, but this didn't seem right and I think I noticed a hit to performance.

    Is this a bug with Kendo mobile or is there a better way to go about this? I want to avoid having to wire up each of my views individually if possible.

    Regards
    Dean
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2596 posts

    Posted 21 Jun 2013 Link to this post

    Hi Dean,

    I have simulated the case you are describing using our TabStrip demo and the code you provided for handling the swipe events. I had it deployed on an iOS device and all the swipe events were correctly handled, even after changing views. Here is a JSBin with my code:

    http://jsbin.com/ajukeq/1/edit

    Can you please compare it with what you have developed or make it simillar to your application, so we can see, when the problem occurs.

    Regards,
    Kiril Nikolov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Dean
    Dean avatar
    73 posts
    Member since:
    Oct 2012

    Posted 23 Jun 2013 Link to this post

    Hi Kiril,

    Thank you for your response. I copied your JSBin code into a new icenium project and slowly added bits of code from my application until it stopped working, then removed code until it started working again. After some time I've narrowed it down to simply adding  the "transition: slide" option when initialising the kendo mobile application.

    So, if you just change this
    var app = new kendo.mobile.Application(document.body);
    to
    var app = new kendo.mobile.Application(document.body, { transition: "slide" });
    and test on an iPhone you should experience the behaviour I described in my first post.

    Regards
    Dean
  4. Answer
    Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2596 posts

    Posted 24 Jun 2013 Link to this post

    Hello Dean,

    Indeed this is a bug, I have managed to reproduce it on my end too. This issue will be addressed in one of our next releases. I would suggest you to keep an eye on the Internal Builds that we release on a regular basis.

    As a gesture of gratitude for bringing this to our attention I have added some telerik points to your account. 

    Regards,
    Kiril Nikolov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top