Disable Header Sort Event
Disable Header Sort Event
jimboy
Posts: 20Questions: 9Answers: 0
Hi,
How do disable the headers click sorting event? Below doesn't work.
function InitDataTable() {
var $this = $('#table');
$this.dataTable({
dom: 'frltip'
initComplete: function (settings, json) {
$(this).unbind('click.sorting'); //not working
$(this).find("th").off("click.DT"); //not working
}
})
$this.unbind('click.sorting'); //also not working outside initComplete
$this.find("th").off("click.DT"); //also not working outside initComplete
console.log('init_datatable');
}
Thanks,
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
What's the objective? Are you trying to turn off sorting on all of the columns in your table? If that's the case, then you can do the following (from this page) when intialising your table:
If that's not what you're after, you'll probably have to give a little bit more background information.
Hi TooManyTables,
Yes, I'm trying to turn off all the columns sorting and removing the sort icon.
Below code works,
Just what I was looking for too.