Open noxtri opened 8 years ago
@noxtri did you solve this situation?
I'm facing this same issue. I have several datatables (displayed in different sections of my webapp) that I initialize on my client startup code and I've realized that to get the desired reactivity I must first recreate the tables to update their internationalization settings and then rerender the current template to display the updated tables.
My workaround consist in:
Create a global helper 'renderTables' that returns the value of a boolean ReactiveVar global.renderTables.
Wrap the tabular template rendering in a conditional block:
{{#if renderTables}}
{{ > tabular table=TabularTables.MyTable }}
{{/if}}
i18n.on('languageChanged', () => {
CreateTables();
global.renderTables.set(false);
Meteor.defer(() => {
global.renderTables.set(true);
});
});
This way, the tables are rerendered when language is changed, but of course is a bit annoying to write this code and create the conditional block to wrap each table or section with tables. It would be great if the package provided a cleaner method to achieve this, like setting a reactive field that tabular evaluates in an autorun block to recreate the tables when the value changes.
I am trying to translate the pagination the search,etc,but using the method from the docs its not reactive if i change the language it doesnt change the texts.I am using it like this.
i actually managed to make the buttons reactive i added some functions to the package because datatables function text caused the buttons to disappear when i was changing the language but i cant manage to change the others without heavy manipulation of the dom.Is there a way to actually translate the pagination,search,etc?