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

Cannot call method 'navigate' of undefined on App

3 Answers 260 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stewart
Top achievements
Rank 1
Stewart asked on 07 Nov 2013, 05:10 PM
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


3 Answers, 1 is accepted

Sort by
0
Accepted
Steve
Telerik team
answered on 08 Nov 2013, 04:24 PM
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.
0
Stewart
Top achievements
Rank 1
answered on 08 Nov 2013, 05:19 PM
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....!
0
Steve
Telerik team
answered on 11 Nov 2013, 08:02 AM
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.
Tags
General Discussion
Asked by
Stewart
Top achievements
Rank 1
Answers by
Steve
Telerik team
Stewart
Top achievements
Rank 1
Share this question
or