The official release of Ext.NET Mobile is now available. Ext.NET Mobile is an ASP.NET component framework for building Phone and Tablet specific mobile web applications. Read More

[CLOSED] Avoid itemtap after itemtaphold

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Avoid itemtap after itemtaphold

    Is there a common way of avoiding itemtap being fired after itemtaphold?
    Last edited by fabricio.murta; Jan 21, 2017 at 4:00 PM. Reason: no user feedback for 7+ days
  2. #2
    I found a "dirty" way to do it, but I think it should be built into extjs.

        // regTapHold should be called from the itemtaphold handler.
        function regTapHold(e) {  
            e._tapHold = true;
        }
    
        // checkTapHold should be called from the itemtap handler, 
        // and if this function returnes true, then skip further execution in that handler. 
        function checkTapHold(e) { 
            if (e._tapHold == true) {
                e._tapHold = false;
                return true;
            } return false;
        }
  3. #3
    Hello @sveins12! And thanks for sharing the solution that works for you.

    Seems there's not much discussion about this around, at least I couldn't find it. And I'm not completely sure in which scenarios that would be a problem, but sounds like an useful feature, for example, to show tooltips on a button when using mobile devices -- quick tap triggers it, and long tap just shows an explanation on what the button does.

    I'm not sure about how "portable" across browsers is your approach, maybe that would be the main issue about handling the different tap behaviors.
    Fabrício Murta
    Developer & Support Expert
  4. #4
    Usually I would like one behavior to occur when tapping quickly and another behavior when the user is holding down an item for a long time.

    The problem is that itemtap is always fired when releasing the finger after a long-tap.

    Maybe itemtap is not the correct event to use when tapping an item quickly/normally? Is there another event for this, which is not always fired when releasing the finger?

    I have seen other discussions about this in the Sencha Touch forums, but I haven't found an acceptable solution there. By the way my solution is standard JavaScript, and I think it should work on all the browsers that support Extjs. But offcourse I don't know if it will mess up other touch events.
    Last edited by sveins12; Jan 10, 2017 at 9:57 PM.
  5. #5
    Hello @sveins12!

    What component exactly are you using as base for the itemtap event? I believe your approach is nice, maybe there could be a 'fasttap' or 'quicktap', 'brieftap' -- something like this -- that implements this approach of checking if the tap was long or slow.
    Fabrício Murta
    Developer & Support Expert
  6. #6
    I am using a Grid component.
  7. #7
    Hello @sveins12!

    Alright, now we are talking!.. You are about this then, right?
    - Ext.Grid - itemtap event

    Do you see in the list, a little above itemsingletap event? Have you tried it instead of itemtap so that the taphold does not overlap?..

    EDIT: But again, imagine itemtap didn't catch the event if the user held tap. We will (in potential) have cases of people who needed the tap to be handled (maybe not a redirecting feedback, but something to signal the application the tap has ended). If itemsingletap does not "filter" this specific behavior itself, the checktap() really sounds like a fair way to avoid the tap when the long event is overlapping.
    Last edited by fabricio.murta; Jan 11, 2017 at 5:09 AM.
  8. #8
    Yes, I tried itemsingletap now, and it has the same issue as itemtap. It also fires when releasing after itemtaphold is fired.
  9. #9
    Hello @sveins12!

    So, in the end, are you okay with using the approach you are, or you rather open a feature request for a specific event that will not be triggering when the tap is a long tap?

    I don't see the current itemtap event behaving this way cause first, it will imply a breaking change for people that want the tap event to be triggered even after a longtap. As a feature, it could be confuse if people use both (say) 'briefitemtap' and 'itemtap' at the same component.
    Fabrício Murta
    Developer & Support Expert
  10. #10
    For my part it's ok now that I have a workaround.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] how to avoid textfield autopostback?
    By hdsoso in forum 2.x Premium Help
    Replies: 3
    Last Post: Jun 02, 2015, 6:40 PM
  2. Replies: 1
    Last Post: May 14, 2015, 9:21 PM
  3. Avoid Treepanel Postback
    By AshwiniRane in forum 2.x Help
    Replies: 0
    Last Post: Jul 08, 2014, 1:45 PM
  4. Avoid Form's control Submit
    By Dominik in forum 2.x Help
    Replies: 3
    Last Post: Oct 10, 2012, 2:02 PM
  5. Avoid flickering of page
    By ganesh.tony in forum 1.x Help
    Replies: 1
    Last Post: Aug 11, 2011, 12:53 PM

Posting Permissions