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

Want to run javascript function on click of a link in a drawer

5 Answers 124 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
100%
Top achievements
Rank 1
100% asked on 19 Feb 2014, 05:11 PM
I am running drawer as the example on

http://demos.telerik.com/kendo-ui/mobile/drawer/index.html

So in my div with data-role="drawer", I have a <li> per list item I want to navigate to with difference data-icons (as in the example).

Inside those li:s, I am using <a> tags which where href="#idToView", like this:

<li data-icon="home"><a href="#home" data-transition="none">Home</a></li>


When I click the list item in the drawer, I am automatically navigated to the view with the id home and the drawer is closed.

What I want is to run a script instead that does those two things.
The reason is that I need to detach some element  I have appended myself in the drawer header before navigating so that kendo does not clone the header while my element is still inside it.

I have tried constructions like:

<li data-icon="home"><a href="javascript:navigate_to_view()" data-transition="none">Home</a></li>

but that will only result in an error message in the error console:
Error: Syntax error, unrecognized expression: unsupported pseudo: navigate_to_view

How do I run that script?

5 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 21 Feb 2014, 09:12 AM
Hello,

The menu that you see inside the drawer is actually a Kendo UI Mobile ListView. You can use its click event in order to perform actions when the user clicks an item from the Drawer:

http://docs.telerik.com/kendo-ui/api/mobile/listview#events-click

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
100%
Top achievements
Rank 1
answered on 21 Feb 2014, 10:22 AM
Where should I put the data-click attribute?
0
Accepted
Kiril Nikolov
Telerik team
answered on 24 Feb 2014, 11:43 AM
Hello,

You can use the example provided in the documentation for reference:

<ul data-role="listview" id="foo" data-click="listViewClick">
    <li>Item 1</li>
    <li>Item 2</li>
</ul>


Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Selvabharathi
Top achievements
Rank 1
answered on 04 Mar 2014, 09:50 PM
Looks good, But how to get load a view from script 
Even if i use APP.navigate i can't able to get back to the previous view on data-role="backbutton" feature 


Any alternate on this

Thanks in anvance
0
Kiril Nikolov
Telerik team
answered on 06 Mar 2014, 11:36 AM
Hi Selvabharathi,

Could you please elaborate a bit more on the problem? How exactly do you navigate between the pages? Please give us a sample, where we can see the issue reproduced.

Thank you in advance for your cooperation.

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
100%
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
100%
Top achievements
Rank 1
Selvabharathi
Top achievements
Rank 1
Share this question
or