Possible to modify subset of dataTable settings based on class?
Possible to modify subset of dataTable settings based on class?
Is it possible to modify pre-existing dataTables by passing in additional objects? Some features I want on all tables, others (e.g. pagination) i only want on certain tables, that have a css 'paginated' class.
I'm using something like the code below but is it possible to instead modify the dataTable() settings for certain selectors, instead of having to re-initialize?
thanks,
Jeff
$(table).dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": true,
"bInfo": false,
"bAutoWidth": false
});
$('table.paginated').dataTable({
"bPaginate": true,
"bLengthChange": true,
"bFilter": false,
"bSort": true,
"bInfo": true,
"bAutoWidth": false,
"iDisplayLength": 20, // default 20 rows
"aLengthMenu": [[20, 50, 100, -1], [20, 50, 100, "All"]]
});
I'm using something like the code below but is it possible to instead modify the dataTable() settings for certain selectors, instead of having to re-initialize?
thanks,
Jeff
$(table).dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": true,
"bInfo": false,
"bAutoWidth": false
});
$('table.paginated').dataTable({
"bPaginate": true,
"bLengthChange": true,
"bFilter": false,
"bSort": true,
"bInfo": true,
"bAutoWidth": false,
"iDisplayLength": 20, // default 20 rows
"aLengthMenu": [[20, 50, 100, -1], [20, 50, 100, "All"]]
});
This discussion has been closed.
Replies
No - features cannot be enabled and disable on-the-fly. You would need to destroy the table (using bDestroy ) and then reinitialise it with the new features that you want. Sorry :-(. Adding the ability to change features on-the-fly would add a lot of code overhead to DataTables and remove the ability to modularise the code, which is going to make up a large part of 1.11.
Allan