DataTables is a fantastic plug-in for the jQuery Javascript library that I use for pretty much all my web development projects. It is a highly flexible tool, based upon the foundations of progressive enhancement, which will add advanced interaction controls to any HTML table – in other words, it creates useful dynamic, with oodles of extra functionality, tables out of plain old vanilla HTML tables.

Today’s question is how to disable sorting on a DataTable instance when it initializes.

Turns out, this is pretty easy to achieve, simply by turning off the bSort property during the method call. In practice:

$('#campaignlinkstable').dataTable({
"bProcessing": true,
"bSort": false
});

Yup, pretty much as easy as that.

(Note that you can further refine your sorting by turning bSort back on and making use of the aaSorting column definition.)

Nifty.