Define a template configuration
Define a template configuration
Hello!
I need make a template configuration for tables, for example:
[code]
// For all tables <-- template
$('.dataTables').dataTable({
'bProcessing': true,
'bStateSave': true,
'sPaginationType': 'full_numbers',
'language': 'configuration'
});
// For specific tables
$('#users_table').dataTable({
"aoColumns": [
null,
null,
null,
null,
{ "bSortable": false }
]
});[/code]
Or maybe I can create config array/object and pass them to the dataTable but how?
It is possible?
I need make a template configuration for tables, for example:
[code]
// For all tables <-- template
$('.dataTables').dataTable({
'bProcessing': true,
'bStateSave': true,
'sPaginationType': 'full_numbers',
'language': 'configuration'
});
// For specific tables
$('#users_table').dataTable({
"aoColumns": [
null,
null,
null,
null,
{ "bSortable": false }
]
});[/code]
Or maybe I can create config array/object and pass them to the dataTable but how?
It is possible?
This discussion has been closed.
Replies
You can't reinitialise the table - so don't think what you currently have would work quite right. What you could do is something like this:
[code]
// For all tables <-- template
var obj = {
'bProcessing': true,
'bStateSave': true,
'sPaginationType': 'full_numbers',
'language': 'configuration'
};
// For specific tables
var objCopy = jQuery.extend(true, {}, obj);
objCopy.aoColumns = [
null,
null,
null,
null,
{ "bSortable": false }
];
$('#users_table').dataTable( objCopy );
[/code]
Hope that helps,
Allan
I am fully satisfied with this solution.
Works perfectly so thanks :)