Handling backbutton on kendo mobile application

3 posts, 0 answers
  1. Yılmaz
    Yılmaz avatar
    3 posts
    Member since:
    May 2015

    Posted 12 Aug 2015 Link to this post

    Hello, I have a problem in my kendo mobile application ,there is a result view in my application and the only way to exit from it should be navigating to main view , i hide header and backbutton on ios but on android hardware back button break my workflow and navigate previous view.

    How can I disable hardware backbutton on that specific view ?



  2. Ventsislav Georgiev
    Ventsislav Georgiev avatar
    17 posts

    Posted 17 Aug 2015 Link to this post

    Hello Yılmaz,

    Thank you for contacting us.

    To disable the hardware backbutton on a specific view you can use:
    // put these functions somewhere, where they will be visible for the view definition
    var emptyFunc = function () { };
    var disableBackButton = function() { document.addEventListener("backbutton", emptyFunc, false); };
    var enableBackButton = function() { document.removeEventListener("backbutton", emptyFunc); };
    // use the data-after-show and data-before-hide attributes on your view definition
    <div data-role="view" /*...*/ data-after-show="disableBackButton" data-before-hide="enableBackButton">
        /* ... */

    When the view is shown we attach an empty event handler for the backbutton cordova event and when it is hidden we remove the empty event handler. See more information about Kendo UI view events.

    If you need any further assistance don't hesitate to contact us.

    Ventsislav Georgiev

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

  3. Yılmaz
    Yılmaz avatar
    3 posts
    Member since:
    May 2015

    Posted 03 Sep 2015 Link to this post

    Thanks a lot Ventsislav, it is working like charm :)
Back to Top