How to set defaults for a plugin?

How to set defaults for a plugin?

pliniocsfernandespliniocsfernandes Posts: 2Questions: 0Answers: 0
edited September 2012 in Plug-ins
I'm using DataTables for a project and need to set default configurations for my DataTable to work the same way across the project.

I can change DataTables defaults with something like:
[code]
$.extend($.fn.dataTable.defaults.oLanguage, {
"sProcessing": "Loading..."
});
[/code]

But I need to set some defaults for a plugin too (ColVis in my case).

I tried:
[code]
$.extend($.fn.dataTable.defaults.oColVis, {
"buttonText": "Change columns"
});
[/code]
But it doesn't work.

How can I do that?

More info:
I'm trying to set i18n options for all my dataTables.
My project uses requireJS to load modules and I'm setting the i18n settings as a module for flexibility.

DataTables debug: http://debug.datatables.net/atupoc
StackOverflow question: http://stackoverflow.com/questions/12435296/how-to-change-defaults-for-a-jquery-datatables-plugin

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    ColVis currently doesn't have the option of being able to set defaults. Its something that should be added in a future version of the plug-in (actually, future development of ColVis will be to integrate it into TableTools, rather than have a separate module, and TableTools can have defaults set already).

    I'd suggest just modifying the ColVis source with the values you want for default.

    Allan
  • pliniocsfernandespliniocsfernandes Posts: 2Questions: 0Answers: 0
    Ok.

    Thanks for the fast reply. :)
This discussion has been closed.