I have 3 SQL queries- services as follows, each of them returns separate infotable containing different number of columns (See attachments). I have configured a list widget to populate the list of these services and I want to execute selected service when selection is changed in list.
To achieve this I am trying to write a java script service, but I am facing a issue since each of above services has their specific datashape as per their result. Could anyone helpout me to write this service to dynamically update the datashape of this java script as per the services which are being called by it or selected by list widget
Just for info, I am quite new to JS, so expecting your reply accordingly.
Solved! Go to Solution.
I went ahead and created a small example for you that shows the dynamic capabilities of the Grid Widget. This ios attached to my post.
As you will see I created a backing service that handles each possible service selection from the End User. This will dynamically change the format of the Infotable returned which results in the contents of the Grid being changed.
Please import the dynamic_grid_entities.xml file prior to importing the Data Table data.
Actually I was trying to import the dynamic_grid_entites.xml file, but its not importing. I think its due to version error. I am using version 8.4.5. Can you just confirm the issue for importing and suggest any alternative. Attaching the screenshot of error log for your reference.
Thank you soo much for your kind help.
Your solution worked. Attaching the result for your reference. I have one more question, here in the screenshot the columns names I am getting are customized in SQL query, with '_', since I was unable to put there space ' '. But This is not good way to represent it, how I can update them by putting space, since SQL does't allow the space.
Happy to have helped and glad the example worked for you!
To modify the column headers the best option is to use the Grid Advanced Widget. The basic Grid does not allow for this kind of functionality with dynamic data and "Show All Columns" enabled. Grid Advanced can be acquired from the PTC Marketplace for free. Download it here.
I have updated the example provided to use the Grid Advanced Widget. Please be sure that Grid Advanced is imported prior to importing this XML. You will now see the Configuration parameter on the Grid Advanced Widget takes a String input from a backing service (GridConfiguration) which contains a set of parameters as a JSON object. These parameters allow for a host of advanced customizations including, setting the column headers. In my example you can see "FieldA" etc. has been switched to "Field A" etc.