Disabling one column "sort" feature
Disabling one column "sort" feature
Hello,
Im a noob to ajax but love you data table project F'in brilliant!@!@!
anyways I was wondering if is possible to disable sorting on just one column...
say I want to show the edit / Delete buttons within one of the tables I dont want to sort this column
Thank you
Zach
Im a noob to ajax but love you data table project F'in brilliant!@!@!
anyways I was wondering if is possible to disable sorting on just one column...
say I want to show the edit / Delete buttons within one of the tables I dont want to sort this column
Thank you
Zach
This discussion has been closed.
Replies
Thanks for the kind words! It certainly is possible to disable sorting on just one column - what you are looking for is the 'bSortable' parameter: http://datatables.net/usage#bSortable
Have a look at this example: http://datatables.net/examples/example_hidden_columns.html - although it doesn't use the bSortable parameter itself - you'll see the basic usage for this family of parameter.
Hope this does the trick for you.
Regards,
Allan
Thanks a bunch man.
$(document).ready(function() {
$('#example').dataTable( {
"aoColumns": [
/* ID */ null,
/* Type */ null,
/* Make */ null,
/* Model */ null,
/* Year */ null,
/* Size */ null,
/* Fuel */ null,
/* Color */ null,
/* MSRP */ null,
/* Price */ null,
/* Milage */ null,
/* Active */ null,
/* Clearance Item */ null,
/* Date */ null,
/* Links */ { "bSort": false,
"bVisible": true },
] } );
} );
anyidea what im doing wrong?
I might implement a checker in future version which give some kind of warning when unknown parameters are passed in...
Allan
Yes indeed - I see your point. It would probably log a warning to console or something like that, rather than making it a critical failure. Just something to help developers spot an issue like this quick.
Allan
bSortable is still the option you want. If you set that for your first column, then sorting will be disabled for that column, regardless of the data source.
Regards,
Allan