Can you add a click event after startup?

4 posts, 0 answers
  1. Michael
    Michael avatar
    2 posts
    Member since:
    May 2012

    Posted 16 Jan 2013 Link to this post

    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
  2. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 17 Jan 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Michael
    Michael avatar
    2 posts
    Member since:
    May 2012

    Posted 17 Jan 2013 Link to this post

    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


  5. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 17 Jan 2013 Link to this post

    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!
Back to Top
Kendo UI is VS 2017 Ready