General and specialized configuration
General and specialized configuration
GarfieldKlon
Posts: 4Questions: 0Answers: 0
Hi :)
I already have a general configuration for my dataTables. This is just a part of the code:
[code]
$('.dataTables table').each(
function(i)
{
var el = $(this);
var config = {
'sDom': '<"processing" r>t',
'bInfo': false,
'oLanguage': {
'sLengthMenu': ' _MENU_',
'sInfoEmpty': '0/0',
'sInfo': '_START_-_END_ / _TOTAL_',
'sInfoFiltered': '',
'sEmtpyTable': 'no Data',
'sProcessing': 'processing...',
'sSearch': 'Filter:',
'sZeroRecords': ''
},
'oFeatures': {'bProcessing': true},
'bAutoWidth': true,
'bFilter': el.hasClass('filter'),
'bSort': el.hasClass('sort'),
'aaSorting': [], // no inital sorting
'bSortCellsTop': el.find('thead tr:first').hasClass('sort'),
'bSortClasses': false,
'bSearchable': el.hasClass('filter'),
'bPaginate': el.hasClass('paginate')
...
..
.
[/code]
As you can see, this one is executed for each table that looks like:
[code]
[/code]
But now I want to have a specialized config for a particular dataTable, because I want to add some specific column sorting (date sorting with a plugin). How do I achieve that?
I thought I could put the script on the site with that particular table:
[code]
$(document).ready(function() {
$('#watchLists').dataTable( {
"aoColumns": [
null,
null,
null,
{ "sType": "eu_date" },
null,
null,
null,
null
]
// 'bRetrieve': true,
// 'bDestroy': true
} );
} );
[/code]
But that doesn't work...
What's the best way to solve that problem?
greez
GarfieldKlon
I already have a general configuration for my dataTables. This is just a part of the code:
[code]
$('.dataTables table').each(
function(i)
{
var el = $(this);
var config = {
'sDom': '<"processing" r>t',
'bInfo': false,
'oLanguage': {
'sLengthMenu': ' _MENU_',
'sInfoEmpty': '0/0',
'sInfo': '_START_-_END_ / _TOTAL_',
'sInfoFiltered': '',
'sEmtpyTable': 'no Data',
'sProcessing': 'processing...',
'sSearch': 'Filter:',
'sZeroRecords': ''
},
'oFeatures': {'bProcessing': true},
'bAutoWidth': true,
'bFilter': el.hasClass('filter'),
'bSort': el.hasClass('sort'),
'aaSorting': [], // no inital sorting
'bSortCellsTop': el.find('thead tr:first').hasClass('sort'),
'bSortClasses': false,
'bSearchable': el.hasClass('filter'),
'bPaginate': el.hasClass('paginate')
...
..
.
[/code]
As you can see, this one is executed for each table that looks like:
[code]
[/code]
But now I want to have a specialized config for a particular dataTable, because I want to add some specific column sorting (date sorting with a plugin). How do I achieve that?
I thought I could put the script on the site with that particular table:
[code]
$(document).ready(function() {
$('#watchLists').dataTable( {
"aoColumns": [
null,
null,
null,
{ "sType": "eu_date" },
null,
null,
null,
null
]
// 'bRetrieve': true,
// 'bDestroy': true
} );
} );
[/code]
But that doesn't work...
What's the best way to solve that problem?
greez
GarfieldKlon
This discussion has been closed.
Replies
Allan