Is there a way of disabling the column sorting in datatables when clicking on the column header and only allow sorting with the sorting icons (check the red arrow in the picture below)?
My reason for wanting to disable the sorting is that I am using the headers for column filtering and when you click on the header to enter a string the table sorts by that column (I know it's ugly, but I will change the input box design later).
I checked their options and could not find anything. I also checked the source code but that was way way way way beyond my knowledge level.
Thanks for any help/suggestion!
/Patrik
SOLUTION
Add click event handler for each input in the header and stop event propagation to the DataTables plug-in.
$('.filter').on('click', function(e){
e.stopPropagation();
});
DEMO
See this jsFiddle for code and demonstration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With