How to set defaults for a plugin?
How to set defaults for a plugin?
pliniocsfernandes
Posts: 2Questions: 0Answers: 0
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
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
This discussion has been closed.
Replies
I'd suggest just modifying the ColVis source with the values you want for default.
Allan
Thanks for the fast reply. :)