Aggrid vue i18n: Grid header name not translated without refresh after change language

977 Views Asked by At

I'm using i18n for localization in my project but whenever i change the language, all page's translate is okay except grid header names! Its getting normal when i refresh the page.How can fix this situation without refresh ?

2

There are 2 best solutions below

4
On

You can fix this by calling the refreshHeader function on the reader API. try this :

this.gridApi.refreshHeader();

where the gridApi is the API object you get from the onGridReady event params.

EDIT, how to get the gridApi :

the gridApi u get from the params of the onGridReady method being called by the AgGrid component. if you are using reactJs, an attribute named onGridReady in your agGrid component would accept that function.

onGridReady = params => {
    this.gridApi = params.api
    this.gridColumnApi = params.columnApi
...

}
0
On

If you are using headerName, maybe try to use computed() function to get ColDef

Ex:

const colDef = computed(() => // coldef here)