How can I change language option after initialization of Datatable?
How can I change language option after initialization of Datatable?
yadiralizama
Posts: 2Questions: 1Answers: 0
Hi,
Allan, first of all, thanks for your amazing datatable.
I am trying to change the language of datatable after initialization. If user changes the language then datatables reload with the new language.
How can I do this without reinitializing table, or how can I save initialization data and reload again with all features and new language?
Thanks for all
This discussion has been closed.
Answers
There is no option to change the language strings after initialisation - sorry.
Allan
There is a workaround by using jquery to change the text after each draw. Not pretty but works.
I didn't test this specific code so you may need to tweak it if there's any errors. But anyway, hope you get the gist of it.
@allan, I do hope we get a native api for this.
For some of them is it relatively easy to do. For others (the length menu for example) its harder and would increase DataTables' code size more than I would like. The reason I've held back from doing this is that I think it should be all or nothing - consider: why should the empty table message be dynamically changeable but not the length menu.
Having said that, I am starting to think about changing my mind and including an api for the easier ones!
Allan