I am using the DataTables jQuery plugin. The way I want my tables to work though mean I am passing a lot of parameters to the plugin to turn off things:
$('table.data').dataTable( {
'aoColumns': [
null,
{ 'bSortable': false },
{ 'bSortable': false },
{ 'asSorting': ['desc','asc'], 'sType': 'blanks' },
{ 'asSorting': ['desc','asc'] }
],
'bPaginate': false,
'bAutoWidth': false,
'bInfo': false,
'bProcessing': true,
'asStripClasses': [],
'sDom': 'rt'
} );
Across different pages, the aoColumns
parameter will change based on the table, but the other parameters stay the same. What would be the best way to save me repeating code over and over (and make it easier if I change my mind about a parameter later)?
I tried storing a parameter with {'bPaginate': false ...}
but that creates a sub-object. Maybe there is a way to "merge" objects inline or something?