I am trying to set the Header attribute for a column in the DataGrid Component as a variable but it gives me the following error:
I tried assigning it to a local variable
Hello @Takeru Mazuelos,
Thanks for bringing this subject to the discussion.
This post helped us finding a bug. I have already reported the issue to the team and it is going to be fixed on our next release.
Right now, I would suggest the following workaround:
1) Whenever you need to change the column header please use the following API on a Javascript Block:
GridAPI.ColumnManager.ChangeProperty(columnId, 'header', 'new header');
or if you prefer
GridAPI.ColumnManager.ChangeProperty(columnBinding, 'header', 'new header');
Make sure to only use the previous code when the Grid is Initialized. You might need to use the OnInitialize event of the Grid. Learn more about the OnInitialize event here.
Thank you for your swift answer, I'm happy I could help in any way.
@Tiago Miguel Pereira I am getting the following error while implementing the Second JS code on GirdOnInitialize.
Hi @Keshav Raghav
Are you passing your column binding or column block identifier on that parameter?What @Tiago Miguel Pereira posted was an example you need to adapt to your use case, ie, columnBinding is a parameter that you need to fill in with the column binding or id to which you want to change the header.
Cheers,GM