Dynamically assigning data-click on iPhones

6 posts, 1 answers
  1. Anthony
    Anthony avatar
    122 posts
    Member since:
    Jun 2013

    Posted 18 Feb 2015 Link to this post

    Hi
      I am getting confused on how exactly I should be wiring up a click to a button on an iPhone when I want a button to be dynamically created 

    I am aware I shouldn't use onclick, so I could try

    (1) <button data-role="button" data-click="func"></button>

    here the data-click seems to be ignored if I create a button in a View dynamically

    (2) <button id=myButton></button>

    <script>
    $('#myButton').kendoMobileButton({
      click: func
    });
    </script>

    Is this using the same underlying mechanism as data-click? 

    (3) data-bind="events: { click: func }"

    I just stumbled across this in the forums, is this needed for is it a MVVM thing? (which I'm not using)

    thanks
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 19 Feb 2015 Link to this post

    Hello Anthony,

     

    Tried to reproduce this in a Dojo, but to no avail. Can you tell me what I missed?

    http://dojo.telerik.com/@Kiril/EBEnU

     

    Regards,
    Kiril Nikolov
    Telerik
     
    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. Anthony
    Anthony avatar
    122 posts
    Member since:
    Jun 2013

    Posted 19 Feb 2015 in reply to Kiril Nikolov Link to this post

    Sorry, I probably wasn't clear enough

    - You can't use approach 1 if you want to make a button via Ajax
    - You -can- use approach 2, it does work, but is this using the same underlying mechanism as data-click or does it use onclick, i.e. will it suffer from the 300ms delay and be unresponsive?

    We have version 1 of our product that works badly on iPhones, you have to click a button repeatedly for it to have any effect. When I tried approach 2 it still seemed like I had to hit a button multiple times for it to fire a click event (kendo.UserEvents.defaultThreshold is set to 20)

    The problem is this behaviour isn't always reproducible. E.g. I just tried again below and even the onclick seems responsive, but that's probably because it's a small cutdown example
    http://dojo.telerik.com/UkUhe
  5. Anthony
    Anthony avatar
    122 posts
    Member since:
    Jun 2013

    Posted 19 Feb 2015 in reply to Anthony Link to this post

    Interestingly we've just noticed on that url

    http://dojo.telerik.com/UkUhe

    On an iphone 5/6, using a stylus, if you click near the top of any of the buttons it doesn't register the click, if you click near the bottom and sometimes practically underneath the button it does register it.

    Android works correctly

  6. Answer
    Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 21 Feb 2015 Link to this post

    Hello,

    In your dojo, approach #1 and #2 are the same. This is documented in depth in our help. You should combine that with the threshold setting (which is missing in the Dojo you have linked). Please notice the last post in this thread, though. 

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  7. Anthony
    Anthony avatar
    122 posts
    Member since:
    Jun 2013

    Posted 23 Feb 2015 in reply to Petyo Link to this post

    I'm going to hesitantly mark this as answered. I didn't include the threshold setting in my example as it didn't appear to have an effect anyway, but you have now explained why it wasn't having an effect and the buttons do seem more responsive now. I will keep an eye on it but I'm more hopeful now so thanks
Back to Top
Kendo UI is VS 2017 Ready