[Data Grid Web]  Is it possible to pass JSON directly to Data Grid without using structures?
Forge component by OutSystems R&D
Application Type
Traditional Web

I have a server action that returns JSON data based on a selection from a drop down which has table names to be selected. These tables differ in the column names and column count ..

The drop down gets the table names dynamically so the count of tables can not be calculated.

The tables may have any number of different columns.. for example when table A is selected the server action may give JSON data with 2 columns as shown below:


and when a table named Table B is selected it may give 3 different columns as shown below:

The returned JSON is of text data type as we can not define an exact structure for the data being returned.

So can we use the Data Grid component to render these details on screen when a particular table is selected from the drop down?

can we pass the JSON which is of text data type to this component by exposing a REST API?

If it is not possible is there any other way that can dynamically add or change columns to the displayed table based on a selection from a dropdown ? 

Hello @Anjali C 

The way Data Grid component has been designed is to receive the data from a REST endpoint. 

This is just an idea, not tested, but you could try is to create different REST endpoints and use the correct one depending of what you have in the dropdown, if this is possible.

Dynamically adding or changing columns would require to wijmo api using JS (the Data Grid is built on top of Wijmo FlexGrid), but it is not assured that all features work as expected.

Is the multiple REST a possibility?

Bruno Martinho 

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