I have a JQuery Datatable with a checkbox in one of the 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 is initialised like this:
var table = $("#vehTbl").dataTable(
{
...
"aoColumns":
[
...
{
"mDataProp": "SomeName",
"fnRender": somefunction,
"bUseRendered": false
},
...
]
});
So this column is sortable. Now I need to prevent the sort event from being fired when checkbox is clicked (and TickAllBoxes is fired as a result). The sorting should work on the column otherwise.
What could potentially work is to bind a handler to "sort" event of the table and prevent default if caller is "someId" checkbox. I haven't had success in doing so, though.
Any ideas?