sarpay
4/11/2013 - 10:16 PM

[mobile] [kendo] view navigation

[mobile] [kendo] view navigation

//Navigate to a remote view
var app = new kendo.mobile.Application();
function navigateToSettings() {
  app.navigate("settings.html"); // the url of the remote view
}


//Navigate to a local view
var app = new kendo.mobile.Application();
function navigateToSettings() {
  app.navigate("#settings"); // the id of the local view
}


//Navigate backwards to the previously visited mobile View
var app = new kendo.mobile.Application();
function goBack() {
  app.navigate("#:back");
}


//This will print an array of the nav history of the app, with the last element being the current view.
//This also means that you can manipulate this array however you want. 
//You can add or remove views that you do or don't want the back button to stop at as it is tapped.
var app = new kendo.mobile.Application(document.body);
console.log(app.pane.history);


//the data-role="backbutton" widget is the same thing as the physical android back button.


//Also, if you want to simulate the back button when developing in the simulator 
//but don't have a backbutton widget on the screen to click, 
//you can run this line of code from the dev tools console:
$("body").data().kendoMobilePane.navigate("#:back");


//Sometimes you need to pass parameters to your view. 
//You can do this just like any other web site by including a query string to your navigation. 
//QueryString parameter values will be available on your view once you 
//have navigated there on a property named params.

//For example:
//<a href="#my-view?one=1&two=2">...</a>
//<div id="my-view" data-role="view" data-show="onShow">
//  ...
//</div>
function onShow(e) {
    console.log(e.view.params);
}
//Here, e.view.params will be an object representing the data that was passed to the view:
{
    one: 1,
    two: 2
}