overriding parameters datatables

overriding parameters datatables

r3tryr3try Posts: 11Questions: 0Answers: 0
edited December 2012 in General
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

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    I'd suggest setting global defaults: http://datatables.net/release-datatables/examples/advanced_init/defaults.html

    Allan
  • r3tryr3try Posts: 11Questions: 0Answers: 0
    so there is no way to set such things as "fnDrawCallback" AFTER initialization?
  • ulrikeulrike Posts: 39Questions: 1Answers: 0
    Does this help : http://datatables.net/forums/discussion/comment/42791#Comment_42791 ?
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    edited December 2012
    > so there is no way to set such things as "fnDrawCallback" AFTER initialisation?

    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
This discussion has been closed.