overriding parameters datatables
overriding parameters datatables
Hi guys, i am using the datatable plugin multiple times in my application.
All of my tables should have the same basic-functionality but for every table i want to be able to specify the "aoColumns" parameter seperately.
(How) is this possible?
the basic code looks like this:
[code]
jQuery('.dataTable').each(
function () {
if (jQuery(this).find('thead').length > 0) {//only apply when element has a thead element
jQuery(this).dataTable({
//"sScrollX": "100%",
"bScrollCollapse": true,
"bAutoWidth": true,
"oLanguage": {
"sSearch": ""
},
"bStateSave": true,
"sPaginationType": "full_numbers",
"fnDrawCallback": function () {
jQuery(this).find('tr').bind('mouseenter', function () { jQuery(this).addClass('MyMouseOverRow'); });
jQuery(this).find('tr').bind('mouseleave', function () { jQuery(this).removeClass('MyMouseOverRow'); });
jQuery(this).find('tr').bind('mouseover', function () { jQuery(this).attr("style", "cursor:pointer"); });
}
});
}
}
);
[/code]
But as i said i want to specify a different "aoColumns" parameter for each table (to specify sorting columns etc..)
Im glad for any help on this...
Best regards,
r3try
All of my tables should have the same basic-functionality but for every table i want to be able to specify the "aoColumns" parameter seperately.
(How) is this possible?
the basic code looks like this:
[code]
jQuery('.dataTable').each(
function () {
if (jQuery(this).find('thead').length > 0) {//only apply when element has a thead element
jQuery(this).dataTable({
//"sScrollX": "100%",
"bScrollCollapse": true,
"bAutoWidth": true,
"oLanguage": {
"sSearch": ""
},
"bStateSave": true,
"sPaginationType": "full_numbers",
"fnDrawCallback": function () {
jQuery(this).find('tr').bind('mouseenter', function () { jQuery(this).addClass('MyMouseOverRow'); });
jQuery(this).find('tr').bind('mouseleave', function () { jQuery(this).removeClass('MyMouseOverRow'); });
jQuery(this).find('tr').bind('mouseover', function () { jQuery(this).attr("style", "cursor:pointer"); });
}
});
}
}
);
[/code]
But as i said i want to specify a different "aoColumns" parameter for each table (to specify sorting columns etc..)
Im glad for any help on this...
Best regards,
r3try
This discussion has been closed.
Replies
Allan
fnDrawCallback - yes. Listen for the `draw` event: http://datatables.net/docs/DataTables/1.9.4/#draw . bSort etc - no, there is no way to change them after initialisation.
Allan