-
Notifications
You must be signed in to change notification settings - Fork 490
When live switching the language with angular-translate, angular-datatables does not change/recognise the current language #351
Comments
Interesting. I'll look into it when I'll find some time. |
Any Ideas? |
Sorry. Had some RL stuffs to deal with. |
Same problem here. My solution was to include the header definitions in the view and then not use the DTColumnBuilder because it always overwrites the column title.
In my controller I build the dtColumn manually:
|
I do have a related question though... how do I translate the data of a column. For example: "Status"
but the translation never happens. ------- SOLVED ------
|
It's not possible if the title is provided in the options and not directly in the HTML code. Remove the assignation of the title in the factory if the title is undefined.
As @OlympicLarry said, the workaround is to define the title directly in the HTML code. |
分享下我的解决方式 .withOption('headerCallback', headerCallback) var headerCallback = function( thead, data, start, end, display ) { |
1- Listen to the language change to render the table afterwards.
2-Inside constructor function of your table
3-
Works for me ;) |
I use angular-translate with angular-datatables and implemented a language switch between german and english (Explained here: http://angular-translate.github.io/docs/#/guide/07_multi-language ) Switching language works well but not with angular-datatables. When i switch angular-datatables keeps the old translations for the table header.
*angular-datatables Controller:
It's loading the datatables data via json with a promise and then draws the table. It also refreshes the table every 5 minutes. I implemented a public function "rerenderTable" which i call when switching the app language.
Function to switch language:
Triggered here in html:
Summary: Switching languages works well. But not in the case of angular-datatables. It does not switch the language. But translating the strings is fine.
How do i get angular-datatables to rerender the table by using the currently chosen language?
The text was updated successfully, but these errors were encountered: