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

How to switch views programatically.

2 Answers 570 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 07 Mar 2012, 09:57 PM
I have an application that contains kendoGrids. In the grids I have click events on column templates. So when a click happens I need to show a different view. I have a tabStrip as my navigational control, but during the click event I can not get the kendoMobileTabStrip object. It always comes back as undefined. So unfortunately I can't get to switchTo function. I'm using...
 
var tabStrip = $('#navigation').data('kendoMobileTabStrip');

Can someone advise please?

2 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 08 Mar 2012, 09:58 AM
Hello,

You can use the (currently undocumented) application.navigate(url) method, where application is your mobile application instance.

All the best,
Petyo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Richard
Top achievements
Rank 1
answered on 08 Mar 2012, 03:27 PM
That worked nicely. Thank you for the help. But I did have to play around with the way I was getting the instance of the application for it to work correctly. For some reason when I was initializing the application in the js file the page would go blank when navigate was called. And the transitions were not sliding in the original directions. So in case anyone else comes across some issues with the application instance, here is how I handled it.

This is my js module...
var ActivitiesApp = (function () { 
    var _app = undefined;
    return {
        init: function () {
            $("#btnTech").on('click'function () {
                ActivitiesApp.getApplication().navigate('#techActivitiesView');
            });
        },
        getApplication: function () {
            return _app;
        },
        setApplication: function (app) {
            _app = app;
            return this;
        }
    };
} ());
$(document).ready(function () { ActivitiesApp.init(); });



This is on the htm page...
<script type="text/javascript"> 
    ActivitiesApp.setApplication(new kendo.mobile.Application($(document.body), { 
            layout: "mobileManagerLayout"
            hideAddressBar: true
            transition: "slide" 
        })
    );
</script>
Tags
General Discussions
Asked by
Richard
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Richard
Top achievements
Rank 1
Share this question
or