281
Views
4
Comments
Solved
[OutSystems Data Grid] Dinamically set the header text for columns in Datagrid
outsystems-data-grid
Reactive icon
Forge asset by OutSystems

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 




2020-08-31 15-57-57
Tiago Miguel Pereira
Staff
Solution

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.


UserImage.jpg
Takeru Mazuelos

Thank you for your swift answer, I'm happy I could help in any way.

UserImage.jpg
Keshav Raghav

@Tiago Miguel Pereira I am getting the following error while implementing the Second JS code on GirdOnInitialize. 

GridAPI.ColumnManager.ChangeProperty(columnBinding, 'header', 'new header'); 

2022-11-12 11-28-30
Gonçalo Martins
Staff

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

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.