Skip to main content
13-Aquamarine
March 10, 2021
Solved

Dynamically creating columns - Grid Advanced rendering issue

  • March 10, 2021
  • 1 reply
  • 2716 views

Hi guys, 

 

I have an issue with GridAdvanced widget.

 

I have a service with standard data shape defined and I am also creating new columns based on input coming from JSON (means: creating column names based on input).

 

When I bind a data from that service to the GridAdvanced Widget, it happen sometimes at runtime, that rendering of columns is not as I want, e.g. for hyperlink I will get only URL instead of clickable href and instead of checkbox for boolean I will get only a text.

 

But it happen only in some cases, when I am creating new columns at runtime and get the error in console: 

mvajla_0-1615381647085.png

What can I do to avoid this behavior? 

 

(Using standart od Dynamics grid does not help, because when I select "Show all columns" it lost that renders (checbox/hyperlink))

 

 

Best answer by mvajla

I had to solve it in different way.
Instead of creating basic DataShape, I have created DataShape with all potential fields and Iam dynamically removing them throught service. But this didn't solve the issue with AdvancedGrid, so I had to use DynamicColumns Grid with Show Dynamic column option.

 

Now it is rendering fine, but it is not so dynamicall as  I wanted - but Working 🙂

1 reply

Community Manager
March 11, 2021

Hi @mvajla.

 

Is it possible that the data coming in sometimes does not match the data shape?  Have you checked the logs in \ThingworxStorage\logs for errors (Script log and Error log)? You many need to compare the data between successful processes vs. those that are unsuccessful to track down the cause.

 

What version of ThingWorx are you running?  Are you storing the JSON data in an infotable?

 

Regards.

 

--Sharon

mvajla13-AquamarineAuthor
13-Aquamarine
March 12, 2021

Hi @slangley , 

 

I have created basic datashape for the service which iterate JSON coming from Windchill services to the infotable. 
The output of this service doesn't match that dataShape, but this should not be the issue.

 

In mashup I have a textbox widget, dropdown list, button and Grid Advanced.

The case is, when user put the input to the textbox, it will fetch data to the dropdown list. So user can select some entries from the list and base on this selection, the datashape, or output from the service is changing.

First selection and execution of the service is working fine - in advanced grid every row is fully rendered. 
The issue comes when I select another option and output is changed - rendering is off, but putting it back to the previous selection, everything is ok again. (every time selected rows are changing, I am executing that service again). Only renfering is the issue, all data are displayed.

 

There is also no error in logs. 
I am using ThingWorx 8.4.2-b2151 and Grid Advanced 4.2.1.

 

I was also trying to use DynamicColumnsGrid, but after selecting an option "Show Dynamic Column", it didn't show the dynamically added columns at runtime. Only when I select "Show all columns" it will show all, but also without rendering.

 

Marek

mvajla13-AquamarineAuthorAnswer
13-Aquamarine
March 16, 2021

I had to solve it in different way.
Instead of creating basic DataShape, I have created DataShape with all potential fields and Iam dynamically removing them throught service. But this didn't solve the issue with AdvancedGrid, so I had to use DynamicColumns Grid with Show Dynamic column option.

 

Now it is rendering fine, but it is not so dynamicall as  I wanted - but Working 🙂