Anders Lindén
Anders Lindén

Reputation: 7323

Kendo UI app.navigate("#:back"); not always navigating back

Sometimes, not always

app.navigate("#:back");

does not make the browser navigate backwards in history and the kendo.history array will remain untouched.

Why?

How I check the contents of the array:

var num = kendo.history.locations.length;
for (var i = num - 1; i >= 0; i--)
  console.log(kendo.history.locations[i]);

Tested kendoui version: 2013.3.1424

Upvotes: 0

Views: 516

Answers (1)

Rian Geofandy
Rian Geofandy

Reputation: 56

I customise backbutton on android like this

document.addEventListener("backbutton", onBackKeyDown, false);
function onBackKeyDown(e) {
    e.preventDefault();
    if (kendo.history.locations.length){
        if (kendo.history.locations[kendo.history.locations.length - 2] != ""){
            app.navigate("#"+kendo.history.locations[kendo.history.locations.length - 2]);
        }
    }
}

or you can use custom class like this

$(document).on('touchstart', '.custom-back', function(e){        
    if (kendo.history.locations.length){
        if (kendo.history.locations[kendo.history.locations.length - 2] != ""){
            app.navigate("#"+kendo.history.locations[kendo.history.locations.length - 2]);
        }
    }
}); 

Upvotes: 1

Related Questions