[Data Grid Reactive] Data Grid JSON encoding issue
Forge component by OutSystems R&D

Hello all,

I am using Data Grid Reactive for a project and I am having some issue while the grid is being generated.

After completion of the grid some of the attributes I pass to the Grid Item are lost and are not displayed in the finalised page.

I debugged and noticed that something happens to the serialized JSON variable I pass to the grid, and this happens at some point inside the DataGridReactive module - the picture attached CorrectJSON, is the serialized data JUST BEFORE being passed to the grid, WrongJSON is the same data inside the OnParametersChanged action of the Grid item in DataGridReactive module. I have passed the JSON data into a parser just so it's easier to show here on the forum, no artifacts created by the parser!

You can see the value of the attribute "Problem" loses one quotation mark. Could this be the issue?

I have tried to serialize my data into JSON both via the DataGridReactive ArrangeData action and via standard JSON Serialize. When I use Arrange Data, I get some weird non-linear doubling of some columns in the grid, and the column "Problem" doesn't appear. When I use JSON Serialize, any column after "Problem" doesn't appear at all.

Anyone that can shed some light on this?

Thank you very much!

Fabrizio

CORRECT JSON


WRONG JSON

Hey Fabrizio,


Are you using ArrangeData or JSON Serialize?

Could you send us your sample so we can have a better look at what's going on?


Thank you,

Gabriel Lundgren

Hi Gabriel,

I'm afraid I can't send a sample because it contains company-sensitive data.

I have tried both ArrangeData and JSON Serialize. ArrangeData doubles columns, while JSON Serialize makes some columns disappear. The JSON data arrives at the DataGridReactive module in the same way, with the quotation mark missing in the "Problem" column.

Mind, the attribute "Problem" is the only one in my list that's empty - although not null. It's a string of value "".

When using the JSON Serialize, do you have Serialize Default Values = Yes?

Hi Bruno, yes I have.

With a bit more playing, I think the problem has to do with empty values passed to DataGridReactive. If I delete other attributes and then try to load the grid, I get the same thing where one quotation mark is missing when I look at the debugger in OnParametersChanged.

So actually when building the grid with JSONSerialize, DataGridReactive seems to just look at the values of the first JSONObject in the list, and if it's empty, it just drops the column altogether even though there are values for all the other Objects in the list.

We know your data is private, but can you share the row in the table in the query that you used to create that JSON?

We would like to see what is inside the Problem column.

Is it possible?

Thanks,

Bruno Martinho

This is the state of the first row at the moment. Forgive me for doing in in 3 pics, it's a pretty long row.

Hey Fabrizio,

I have tried to reproduce the issue you mentioned, but I'm not having any success. 


Let me show what I did:


1. First I created a new Entity with several attributes.
2. Populated the entity but left the Description attribute empty on some rows.

 3. This is my FetchData Flow:

Where I simply fetch the data on GetSheet1s aggregate and pass it to arrangeData, then I set the Data attribute with the arrangeData result.


4. This is what my serialized data looks like after going through arrangeData (this is the first row only):

5. The Grid renders fine and all columns are shown:


Can you please show us your Fetch Data flow to see if there is anything different? What's the type of Problem attribute? Is it a string? And could you tell which version of the Grid you are using?


Thank you,

Gabriel Lundgren

Hi Gabriel,

Thank you for the reply. My JSON structure looks fine after the ArrangeData action within my app. The issue then comes up inside the OnParametersChanged action inside the DataGridReactive module, Grid item. When I debug the action, the Data variable shows the "corrupted" JSON structure, with the quotation mark missing.

This is my JSON Serialisation flow at the moment with JSON Serialize action.


The JSON looks like this after JSON Serialize


This is what it looks like inside OnParametersChanged



I'm sorry I forgot to reply to your other questions. The Problem attribute is Text in my entity. DataGridReactive version is 2.3.1

We can't seem to reproduce this. 


Could you tell us a little bit more about how you configured your grid?

Does it have columns or is it auto generated? Do you have any on initialize event that triggers something?

The grid is autogenerated and no trigger events set. These are my configs

So I see there is a newer version of Data Grid Reactive, although when I go on Forge to install it I get a message saying there is no stable version for my environment. I'm on Service Studio 11.12.2

Can you go to your Service Center and check your platform version?


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