Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1816

How to cancel a sort event after it is fired?

$
0
0
Is it possible to cancel a sort event after it is fired?

I have a checkbox column in my table with a "check-all" checkbox in the header. When the checkbox in the header is clicked I want to prevent the sorting from occurring however if any other portion of the header is click I want it to sort. Here's what I've come up with so far but I am not sure how to cancel the sort.

Click event of the "check-all" checkbox

     var checkallClicked = false;
    $('#check-all').click(function() {
        checkallClicked = true;
        ...
    });

Click/sort event of the header

    $('.check-all-header').click(function(){
        if (checkallClicked) {
            checkallClicked = false;
            return false;
        }
    });

Viewing all articles
Browse latest Browse all 1816

Trending Articles