Common Options and Styles

Common Options and Styles

camainccamainc Posts: 19Questions: 3Answers: 0
edited May 2011 in DataTables 1.8
I have several smaller tables on a single page, and they all share the same common options, same number of columns, etc.

How can I set those options once, and then apply them to each of my table instances? I'm thinking like the jQuery $.ajaxSetup() function allows you to set common options for several different ajax calls (i.e.,
http://api.jquery.com/jQuery.ajaxSetup).

Thanks

Replies

  • camainccamainc Posts: 19Questions: 3Answers: 0
    Never, mind, I figured it out. I created the options as a javascript object, and then just passed that object into the constructor.

    [code]
    var tableOptions = {
    "bJQueryUI": true,
    "bPaginate": false,
    "bFilter": false,
    "bInfo": false,
    "aoColumns": [
    { "bSortable": false },
    { "bSortable": false },
    { "bSortable": false }
    ]
    };

    $("#incumbentsTable").dataTable(tableOptions);
    [/code]
This discussion has been closed.