Read options from html
Read options from html
Hello
Can dataTables read options from the individual table like a classname for example? I want to disable sorting on some columns on individual tables without repeating the
$('.tablesorter-js').dataTable({
"aoColumns": [
{ "bSortable": false },
null,
null,
null,
null
]});
Can dataTables read options from the individual table like a classname for example? I want to disable sorting on some columns on individual tables without repeating the
$('.tablesorter-js').dataTable({
"aoColumns": [
{ "bSortable": false },
null,
null,
null,
null
]});
This discussion has been closed.
Replies
Allan
Put the class no-tablesorter-js on the th element you dont want sortable.
var colList = [];
$('.tablesorter-js > thead th').each(function(i){
if (!$(this).hasClass('no-tablesorter-js')) {
colList.push(null);
} else {
colList.push({'bSortable': false });
}
});
$('.tablesorter-js').dataTable({
"aoColumns": colList
});