[Data Grid Reactive] Dynamic column names with multiple Grids in one block/page
Forge component by OutSystems R&D

I am using this API function to dynamically set the column name, when a Grid Initializes:

      GridAPI.ColumnManager.ChangeProperty(binding1, 'header', newHeader);

The thing is that now I have two different Grids inside the same block, each one triggering its own OnInitialize Client action, but only works for the second Grid. The first Grid gives back an error:

This column exists:

While I was debugging I saw that both grid's OnInitialize action were triggered at the same time, and since the change column property doesn't refer to any specific GridId, the problem might be that the function is trying to look for the column in the wrong Grid (In the second one instead of the first one). 

Can anyone help me with this? Is there any way to refer to a GridId when using GridAPI.ColumnManager?

Thanks,

Takeru

Solution

Hi Takeru,

The ChangeProperty API is being used internally only. But to change the column header of a specific grid, you can use the following code:

GridAPI.GridManager.GetGridById(gridID).getColumn(binding).provider.header = "header";

Please let me know if this works out for you.

Works perfectly now, thank you!

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