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

app.navigate() in data-before-show

1 Answer 55 Views
View
This is a migrated thread and some comments may be shown as answers.
Robby Parker
Top achievements
Rank 1
Robby Parker asked on 15 Jul 2015, 02:29 PM

I can't seem to get app.navigate to switch to a local view. No errors in console.

Please tell me why this simple example doesn't work.

HTML:

<div data-role="view" data-layout="default" id="journalDefault" data-before-show="doesNeedLogin">
    Journal Entries
</div>
 
<div data-role="view" data-layout="default" id="journalAddNew">
    Add Entry. Get ID from Listview.
</div>
 
<div data-role="view" data-layout="default" id="journalLogin">
    Need to login.
</div>

JS:

function doesNeedLogin(e)
{
    var isLoggedIn = false;
     
    if (isLoggedIn)
    {
        alert("Logged In");
    }
    else
    {
        alert("Not logged in");
         
        //show them login view
        app.navigate("#journalLogin");
    }
}

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 17 Jul 2015, 07:06 AM
Hi,

you need to call prevent default - please check the snippet in the documentation.
Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
View
Asked by
Robby Parker
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or