How can I avoid column sorting if I have checkbox and popup controls in the header?

How can I avoid column sorting if I have checkbox and popup controls in the header?

ctothctoth Posts: 1Questions: 0Answers: 0

I have a DataTables table, which has checkboxes and popups in some of the header columns. (Plus I use FixedColumn and ColReorder plugins too). Here is a mock-up of what I have: http://jsfiddle.net/csabatoth/pgue1sf5/8/
My problem is that if a user tries to check the checkboxes or push the popups, the sorting event takes over everything. The jsfiddle page is not functioning fully, because in my app I receive the events for the checkbox click, but it's too late at that time, the sorting also happens.
The sort icon is just a background CSS for the header cells, and the sorting event is registered for the whole header cell by DataTables.

Plans to solve this problem:
1. Register handlers and try to prevent the running of Datatables's own handlers. As of now, if I also register an event handler for the header cells, I'll get the event only after DataTable's handler, the events are delivered in registration order. I also registered handlers for the checkbox and the popup itself, but those are also delivered only after DataTables's handlers (bubbling up).
This could only work if I could somehow register my handler before DataTables's own handler, but I haven't found an entry point to do that. The table DOM should be already generated, when the event is registered. Right now I see too late occasions, I can only register.
2. Finding an API call point where I could cancel DataTables's sorting. The order event (http://datatables.net/reference/event/order) seems to be after the fact, I don't see a way for cancellation.
3. At some point I restructured the non-fixed column headers to contain two rows: the top row was for sorting and the bottom contained my checbox and popup controls. That seemed to work except that it turned out that it doesn't work with the ColReorder plugin. I need that plugin, and it only reordered the top row of the header, the bottom stayed there. If I could fix that, it would be a solution also.

This discussion has been closed.