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

Actionsheet firing twice on ios(iPhone)

9 Answers 135 Views
ActionSheet
This is a migrated thread and some comments may be shown as answers.
Joon
Top achievements
Rank 1
Joon asked on 23 Jun 2012, 06:36 AM
Hi,
I have a action button that fire OK. But the issue is it fires the event twice on ios safari browser, once initially and another on a next touch on the screen. This does not happen on my desktop Chrome.

Any help would be much appreciated. Thanks.

<a data-role="button" data-rel="actionsheet" href="#my_received_actionsheet" data-align="right" data-icon="action" >Action</a>


        <ul data-role="actionsheet" id="my_received_actionsheet">
            <li class="km-actionsheet-title">You Action Required : </li>
            <li><a href="#" data-action="my_received_action.confirm">Confirm booking</a></li>
            <li><a data-action="my_received_action.decline">Decline booking</a></li>
            <li><a data-action="my_received_action.mark_as_paid">Mark as paid</a></li>
        </ul>


<script>
        var my_received_action = {
            confirm: function (e) {
                alert("confirm");
            },
            decline: function (e) {
                alert("decline");
            },
            mark_as_paid: function (e) {
                alert("mark_as_paid");
            }
        }
</script>

9 Answers, 1 is accepted

Sort by
0
Joon
Top achievements
Rank 1
answered on 23 Jun 2012, 07:04 AM
a
0
Juan Carlos
Top achievements
Rank 1
answered on 12 Nov 2012, 12:44 PM
any solution?
0
Ibrahim
Top achievements
Rank 1
answered on 12 Nov 2013, 05:52 AM
I have same problem. Any solution for this?
0
Kiril Nikolov
Telerik team
answered on 12 Nov 2013, 04:35 PM
Hello Ibrahim,

This issue was fixed a while ago, can you reproduce it using the latest version of Kendo UI? If the problem persists after upgrading, please extract a runnable sample and we will be more than happy to take a look. 

Kind regards,
Kiril Nikolov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ibrahim
Top achievements
Rank 1
answered on 13 Nov 2013, 01:04 AM
Hi Kiril,
I test it using examples for basic usage of actionsheet (http://demos.kendoui.com/mobile/actionsheet/index.html#/) and add alert for every action:

    function reply(e) {
        $("#actionResult").html("Replying to message #" + e.context);
        alert("reply");
    }

    function replyAll(e) {
        $("#actionResult").html("Replying to all in message #" + e.context);
        alert("reply all");
    }

    function archive(e) {
            $("#actionResult").html("Archiving message #" + e.context);
            alert("archive");
    }

It uses latest verson of Kendo UI v2013.2.918, and test it on iPhone (ios 6.0.1) and iPad (ios 5.1.1).

Thank you
0
Petyo
Telerik team
answered on 13 Nov 2013, 07:44 AM
Hello Ibrahim,

Apologies for the confusion. My colleague forgot to mention that the problem is due to the alert function call. If you substitute it with console.log, the events are fired as expected. 

Regards,
Petyo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ibrahim
Top achievements
Rank 1
answered on 13 Nov 2013, 08:10 AM
Hi Petyo,
Do you have any recommendation how to add a confirmation window or alert for an action?
Because the same thing happens when I use window.confirm.

This is my code for window.confirm:

function approve(e) {
        var conf = window.confirm("Approve this request?");

        if (conf== true) {
        }
}

The confirmation window displayed twice.

Thank you,
Ibrahim
0
Petyo
Telerik team
answered on 13 Nov 2013, 09:59 AM
Hello Ibrahim,

a simple trick which works around the problem is to wrap the call in a setTimeout:

 

function approve(e) {
setTimeout(function() {
        var conf = window.confirm("Approve this request?");
 
        if (conf== true) {
        }
 
}, 0);
}

Regards,
Petyo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ibrahim
Top achievements
Rank 1
answered on 13 Nov 2013, 11:35 PM
Hi Petyo,
Thanks for the trick. I'll try it.

Thank you,
Ibrahim
Tags
ActionSheet
Asked by
Joon
Top achievements
Rank 1
Answers by
Joon
Top achievements
Rank 1
Juan Carlos
Top achievements
Rank 1
Ibrahim
Top achievements
Rank 1
Kiril Nikolov
Telerik team
Petyo
Telerik team
Share this question
or