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

Handling backbutton on kendo mobile application

2 Answers 204 Views
Apache Cordova
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Yılmaz
Top achievements
Rank 1
Yılmaz asked on 12 Aug 2015, 10:36 AM

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 Answers, 1 is accepted

Sort by
0
Ventsislav Georgiev
Telerik team
answered on 17 Aug 2015, 02:24 PM
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">
    /* ... */
</div>

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.

Regards,
Ventsislav Georgiev
Telerik
 

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

 
0
Yılmaz
Top achievements
Rank 1
answered on 03 Sep 2015, 11:21 AM
Thanks a lot Ventsislav, it is working like charm :)
Tags
Apache Cordova
Asked by
Yılmaz
Top achievements
Rank 1
Answers by
Ventsislav Georgiev
Telerik team
Yılmaz
Top achievements
Rank 1
Share this question
or