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

Dynamically assigning data-click on iPhones

5 Answers 103 Views
Button (Mobile)
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 18 Feb 2015, 09:18 AM
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

5 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 19 Feb 2015, 10:29 AM

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!
 
0
Anthony
Top achievements
Rank 1
answered on 19 Feb 2015, 11:04 AM
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
0
Anthony
Top achievements
Rank 1
answered on 19 Feb 2015, 12:00 PM
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

0
Accepted
Petyo
Telerik team
answered on 21 Feb 2015, 09:04 AM
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!
 
0
Anthony
Top achievements
Rank 1
answered on 23 Feb 2015, 08:56 AM
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
Tags
Button (Mobile)
Asked by
Anthony
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Anthony
Top achievements
Rank 1
Petyo
Telerik team
Share this question
or