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

Can you add a click event after startup?

3 Answers 55 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 17 Jan 2013, 12:42 AM
Edit:

I would delete this post and start a new one if the forum let me. The actual source of my problem is this piece of sample code for your site.

<ul data-role="listview" id="foo" data-click="listViewClick">
    <li><a data-role="button" data-name="bar">Bar button</a> | <a data-role="button" data-name="baz">Baz button</a></li>
</ul>

<script>
 function listViewClick(e) {
     console.log(e.button); // Kendo mobile Button instance
 }
</script>


It seems to indicate that there is some magical way to know that the button was clicked and which button was. It does not seem to work in practice as running this example e.button is always null for me, so I cant figure out how to distinguish between a row click and a click on the button.

Mike

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 17 Jan 2013, 02:53 PM
Hi Mike,

I am not sure why e.button is null in your scenario. Please compare your implementation with this one and let me know if you need more information:

http://demos.kendoui.com/mobile/button/events.html

Greetings,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Michael
Top achievements
Rank 1
answered on 17 Jan 2013, 03:15 PM
Hi Dimo,

Sorry for the confusion. The code I posted is a sample from your site.

http://docs.kendoui.com/api/mobile/listview

Its the events section of the listview.

So, its specific to listview and not really my code. Any ideas?

Mike


0
Dimo
Telerik team
answered on 17 Jan 2013, 03:36 PM
Hello Mike,

It seems the documentation is messed up and needs fixing, sorry about that.

If you need click handlers for buttons, please attach handlers directly to them, as shown previously. The ListView click event exposes the clicked item as e.item, not the buttons inside.

Regards,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ListView (Mobile)
Asked by
Michael
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Michael
Top achievements
Rank 1
Share this question
or