JQuery DataTables - Prevent sorting on sortable column -
i have jquery datatable checkbox in 1 of column headings:
<table id="vehtbl" class="table table-striped table-bordered"> <thead> <tr> ... <th> <input type="checkbox" id="someid" onchange="tickallboxes()" /> publish </th> </tr> </thead> </table>
my datatable initialised this:
var table = $("#vehtbl").datatable( { ... "aocolumns": [ ... { "mdataprop": "somename", "fnrender": somefunction, "buserendered": false }, ... ] });
so column sortable. need prevent sort event being fired when checkbox clicked (and tickallboxes fired result). sorting should work on column otherwise.
what potentially work bind handler "sort" event of table , prevent default if caller "someid" checkbox. haven't had success in doing so, though.
any ideas?
try add in script after datatable initialised, , see?
var table = $("#vehtbl").datatable( { ... "aocolumns": [ ... { "mdataprop": "somename", "fnrender": somefunction, "buserendered": false }, ... ] }); // add in $('input[type=checkbox]').click(function(event){event.stoppropagation()});
Comments
Post a Comment