Rodrigo Pires
Rodrigo Pires

Reputation: 574

Datatables jquery plugin - setting defaults

I'm trying to set default configurations to be used everytime the datatable plugin is called, but it is not working. The defaults are just ignored.

Example:

$.extend($.fn.dataTableExt.defaults, {
            "sPaginationType": "full_numbers",
        });

        $content.find("table.datatable").dataTable({
            "bServerSide": true,
            "sAjaxSource": '@Url.Action("ListaGrid")'
         });

In the case above, the configuration "sPaginationType" is not applied.

Any tips?

Thank you.

Upvotes: 0

Views: 2945

Answers (2)

Plínio César
Plínio César

Reputation: 6025

In 1.9.3 you can change defaults like:

$.extend($.fn.dataTable.defaults, {
    oLanguage: {
        "sProcessing": "Loading... please wait."
    }
});

But this only works for the basic settings and not for any extra (plugins).

Upvotes: 2

Rodrigo Pires
Rodrigo Pires

Reputation: 574

Figured out that it is not working because I'm using datatables version 1.8.1, which doesn't accept defaults yet.

Anyway, does anybody know how can I declare the default options (i.e. in a variable) and use it as default in every datatables instance??

Thank you!

Upvotes: 0

Related Questions