Defer Click Fix #30

azoff opened this Issue Nov 25, 2011 · 0 comments


None yet
1 participant

azoff commented Nov 25, 2011

Hi Azoff,

first of all, great work on this. I have had an issue with the click event handling, though. I was able to solve it, so I wanted to share for future releases. Here goes:

deferClick: function(target) {
    var events ='events');
    if (events && && {
        events =;
        function(event) {
            event.preventDefault(); - >event.stopPropagation(); - >event.stopImmediatePropagation();
            function(i, event) {
        }); - >
    } else { - >'click',
        function(event) { - >event.preventDefault(); - >event.stopPropagation(); - >event.stopImmediatePropagation(); - >
        }); - >

I marked all new lines with -> arrows. To explain: I am using your script in combination with jqGrid. It allows you to select rows by clicking. The click event however is not on the dragging element (e.g. the ) but on the parent (). The previous code would only prevent click events for the element itself and reattach any previously detached click events. My extension always defers the click event, and stops propagation, so the click event won't be fired on parent elements.

Hope this helps.

azoff closed this in 817f785 Nov 25, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment