Hello everyone,
I'm facing an issue with the Data Grid component in OutSystems when dynamically generating JSON data with a variable number of columns.
Context
I am not using the ArrangeData function because my grid has dynamic columns (I don’t know the exact number of columns in advance).
Instead, I build the JSON dynamically using a loop to generate the required structure.
The grid loads and displays the data correctly when adding more columns.
The problem occurs when reducing the number of columns (N → N-1): the grid does not reflect the updated JSON and continues displaying the old structure.
Issue
When the JSON structure changes (removing a column), the Data Grid does not update correctly and still shows the previous columns, even though the JSON source has been updated. It seems like the grid is not fully refreshing or recognizing the new structure.
Hi @João Vilelas
I found a possible wait to make it work and fixed some small details on your JSON generation process since I got an invalid JSON from your sample.You can find it attached to this post.
Hope it helps!
Cheers,GM
Hello @João Vilelas
To make collaboration more efficient, please share a sample oml with your use case so the community members don't need to invest extra time trying to replicate it.Also, what's the OutSystems Data Grid version you're using? Have you tried to compare your JSON generated manually (not the more reliable way IMO) with one from ArrangeData or JSONSerialize?
Best Regards,GM
I’m sharing an example of my issue: we cannot use ArrangeData or JSONSerialize because we don’t know the number of columns in advance, meaning we can’t create a fixed structure to accommodate this requirement.
It worked perfectly! :) Thank you very much.
One question: Is it possible to insert an HTML command (e.g., an icon) inside the JSON so that the Data Grid renders it on the front end?
Glad to know it helped!
About your other question:
OutSystems Data Grid is created around Wijmo Flexgrid so, I would suggest always looking into their documentation for examples since it's quite complete.
However, for the use case you're mentioning, usually adding HTML inside JSON might cause some formatting issues (including due to sanitizing the data) and is not ideal. What you can do is something mentioned in several other posts like this (ideally you would be using Column blocks that are supported and you can have images).