Cannot call method 'navigate' of undefined on App

4 posts, 1 answers
  1. Stewart
    Stewart avatar
    37 posts
    Member since:
    Oct 2013

    Posted 07 Nov 2013 Link to this post

    This is actually relating to this functionality to navigate around the app from JavaScript:

    var app = new kendo.mobile.Application();
    app.navigate("#tabstrip-home");

    I've been using is in various places in the app until I realised that I was in fact creating multiple instances of the application, which was not my intention and I guess could lead to problems and slowness.

    After googling, I came across this web site that says to use the original instance used to initialise the app, but I can't seem to make it work? The following code is somewhat redundant as I know you can set the home view on initialisation of the app, but I wanted to see how it worked and the answer is that it doesn't at least not for me...

    (function (global) {
         
        var mobileSkin = "",
            app = global.app = global.app || {},
            os = kendo.support.mobileOS,
            statusBarStyle = os.ios && os.flatVersion >= 700 ? "black-translucent" : "black";
     
        document.addEventListener('deviceready', function () {
            navigator.splashscreen.hide();
        }, false);
     
        var app = new kendo.mobile.Application(document.body, {
            layout: "tabstrip-layout",
            statusBarStyle: statusBarStyle,
            //useNativeScrolling: true
        });
         
        app.navigate('#tabstrip-workshops');
     
    })(window);

    The error seen in the console log is "Cannot call method 'navigate' of undefined on App". Can anyone assist?

    Stewart


  2. Answer
    Steve
    Admin
    Steve avatar
    10941 posts

    Posted 08 Nov 2013 Link to this post

    Hello Stewart,

    I see you're using the Icenium Kendo UI template as base. However in that template app is a global wrapper and you can see that the app is instantiated like this:

    app.application = new kendo.mobile.Application(document.body, { layout: "tabstrip-layout", statusBarStyle: statusBarStyle });

    Thus, you should use app.application.navigate instead. Debugging your Icenium app to find out such problems is easy using the built-in developer tools in the Icenium simulator (see screehshot).

    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  3. Stewart
    Stewart avatar
    37 posts
    Member since:
    Oct 2013

    Posted 08 Nov 2013 Link to this post

    Thanks Steve, that sorted it.

    Would have been nice to see that documented somewhere - for example a comment in the app.js - as I couldn't find any resolution anywhere despite several hours of searching on forums and Google....!
  4. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 11 Nov 2013 Link to this post

    Hello Stewart,

    We're considering simplifying our default templates as they seem to be too complex for most users, especially if they're just starting with mobile development and Kendo UI.

    Thank you for the feedback!

    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
Back to Top