[Data Grid Web] Saving user configuration in a grid with a variable number of columns leads to errors
Forge component by OutSystems R&D
Application Type
Traditional Web


We have a DataGrid that has a variable number of columns depending on the selection that the user makes. The column headers are also dependent on this selection. When users save their grid configuration that leads to errors:

  • The actual data in the columns do not always match the header anymore. 
  • When the new selection includes more columns than there were in the saved configuration, the grid hangs during rendering.

How can I resolve these issues?
Or otherwise: what is a better approach for this use case?

Alfio Esposito

Hi Alfio,

I am also struggling with this issue myself. Please let me know if you found an resolution!




Thank you for bringing this issue into discussion.

In order to better understand the problem, can you send us a sample?


Gabriel Lundgren

Hi Gabriel,

Thanks for looking into this. I have attached a oml-file with an example that is similar to what we have in our actual system.

Notice how the columns, headers and the content of the grid change when you click Show All, Show First 2 and Show Last 2.

Click Show All and then click Save configuration.
Next click Show first 2. Notice that still all columns are shown with the headers that correspond to the All-view instead of just the columns and headers that correspond to the First2-view. The data fields show the values of the first 2 data columns.

Clear the configuration and switch to Show First 2. Then save the configuration again.
Next click Show Last 2. Notice that the headers still correspond to the First2-view instead of the headers that correspond to the Last2-view. The data fields show the values of the last 2 data columns.

Clear the configuration and switch to Show First 2. Then save the configuration again. Then click Show All. You will now see that the grid 'hangs'.



Hi Alfio,

The "Save Configs" as far I could see, works considering User and Page, as you are using the same page to handle different columns definition, right after grids renderization, the configuration feature note that you have a config saved and tries to apply it .

As we change grids structure, some of the columns are no more available.

The save configs will save your grid configuration per column (header, sort and filter definitions, position, visibility etc), the key used to do it is the JSONField, in your case "Col1", "Col2", "Col3", "Col4" and "Col5".

So when you save configuration for a grid with 5 columns, and you change to 2 columns, the code will render untill "Col2", when the configs are applied the "Col3" isn't available, and we have an error.

I will open a Support case so your case can be analyzed, by now, not to let you stuck waiting for us, I would suggest one of the solutions bellow:

  1. Create different pages depending on the structure you want. In this case the Save configs will work just perfectly
  2. Maintain the different structures on the same page, but remove the "Save Config" button

Hope I could help you

Hi Ricardo,

Thanks for your response and thanks for opening the support case.

I have looked into your first suggestion for the workaround. Unfortunately this will not work for us, because the column header text is also saved when you save the user config. In our real system these texts are dependent on user selection as well, so there is no way for us to know in advance which text will end up in which column header (this is not part of the example I made because I thought that would not be required to demonstrate the issue).

Is there any way to circumvent the saving of the header text when you save the user config?

Alfio Esposito

Hello @Alfio Esposito ,

We've been trying to come up with another workaround, but couldn't find something that could fit your needs.

Meanwhile, we'll keep you posted about this issue.

Best regards,

Bruno Martinho

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