Multiple default/initialization value

Multiple default/initialization value

mzardmzard Posts: 11Questions: 4Answers: 0
edited April 2014 in General
Hi all,
I see that it's possible to set defaults value, but I'd like to have more defaults/initialization value (I have a lot of table but with different configuration).
Is it possible to have something like this?

$.extend( $.fn.dataTable.defaultsA, {...} );
$.extend( $.fn.dataTable.defaultsB, {...} );

$('#example1').dataTable( use defaultsA);
$('#example2').dataTable( use defaultsB);

Is there some way to manage that?

Thanks in advance
Cheers
Matteo

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    The defaults are global - you can only have 1 default. But you could have multiple configuration objects:

    [code]
    var defaultsA = {...};
    var defaultsB = {...};

    $('#example1').dataTable(defaultsA);
    $('#example2').dataTable(defaultsB);
    [/code]

    Allan
  • mzardmzard Posts: 11Questions: 4Answers: 0
    Much simpler than I imagined... :)

    Thanks!
This discussion has been closed.