locked
nav.navigate not going to next page

    Question

  • I recently retargeted my app and now I am having issue with a list control. when I click on an item the grid it does not invoke the ready function on the next page. Here is the code snippit of the code for the list control:

    _itemInvokedApps: function (args) {
    	if (appView.value === appViewState.snapped) {
    		// If the page is snapped, the user invoked a group.
    		var group = appLstData.groups.getAt(args.detail.itemIndex);
    		this.navigateToGroup(group.key);
    	} else {
    		// If the page is not snapped, the user invoked an item.
    		var item = appLstData.items.getAt(args.detail.itemIndex);
    		var itemObject = appLstData.resolveItemReference(appLstData.getItemReference(item));
    		if (itemObject.enabled == 0) {
    			displayDiag(new Array("This app is currently disabled.\nPlease try again later.", "Disabled Item"));
    		} else if (itemObject.desc === "") {
    			//console.log("No information in object");
    			displayDiag(new Array("No information to display.\nPlease try again later.", "No information"));
    		} else {
    			//console.log("Navigating to the app details page. Item: " + itemObject.detailLink + ", user: " + userSession.id);
    			nav.navigate("/pages/dashboardAppDetail/dashboardAppDetail.html", { item: itemObject, person: userSession });
    		}
    	}
    	function displayDiag(message) {
    		var dialog = Windows.UI.Popups.MessageDialog(message[0], message[1]);
    		//dialog.commands.
    		dialog.commands.append(new Windows.UI.Popups.UICommand("Close"));
    		//dialog.commands.append(new Windows.UI.Popups.UICommand("No", dialogCommandHandler));
    		dialog.defaultCommandIndex = 0;
    		dialog.showAsync();
    	}
    }

    When I add a break point to the next page that is supposed to be called I can see that the define is being called but it completely skips the ready: function.

    Tuesday, December 10, 2013 6:08 PM

Answers

  • If you are using the typical VS template code for a page control, the define function for each page is called when the app loads, so this won't tell you whether your navigation model is working correctly.

    To make sure your nav model is set up correctly: (1) make sure your app includes navigator.js and that this script file is referenced from default.html. (2) Make sure that default.html includes the content host (navigation control). (3) Make sure the page you're navigating to is defined as a Page Control (ui.Pages.define). Also, much more obviously, make sure .navigate is getting called in the code you are showing above.

    For more info, see this topic:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh758331.aspx


    Friday, January 10, 2014 4:38 PM

All replies

  • It is good to enable Debug->Exceptions->Java Runtime Exceptions -> check thrown and debug. This is to ensure that there is no exceptions during page loading.

    double check the html file path that it is same in nav.navigate and Pages.define call. I have seen this happen when renaming folders etc.


    -sushil

    Thursday, December 12, 2013 4:05 AM
  • If you are using the typical VS template code for a page control, the define function for each page is called when the app loads, so this won't tell you whether your navigation model is working correctly.

    To make sure your nav model is set up correctly: (1) make sure your app includes navigator.js and that this script file is referenced from default.html. (2) Make sure that default.html includes the content host (navigation control). (3) Make sure the page you're navigating to is defined as a Page Control (ui.Pages.define). Also, much more obviously, make sure .navigate is getting called in the code you are showing above.

    For more info, see this topic:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh758331.aspx


    Friday, January 10, 2014 4:38 PM