Skip to main content
16-Pearl
July 7, 2020
Solved

Collection widget shall not (fully) refresh upon data update

  • July 7, 2020
  • 2 replies
  • 10626 views

Dear community,

 

in Thingworx 8.4.4. I am using Collection widget to display machine KPIs in a mashup. The contained mashup is assigned in design time and does not change in runtime. Also the number of items (= machines) is never changing, only the related KPIs. So why do I use collection widget at all? Because this is a template, rolled out to several production facilities. Within one facility the number of machines is constant but it varies between the facilities.

 

My original approach was to only read the structure when the mashup is loaded. Then every sub-mashup calls a Service to read and refresh the KPIs. With up to 30 and more machines the overhead becomes quite big, instead of once reading data for all machines I am reading the data for each machine one by one. This is not optimal performance wise and only once we checked the Tomcat logs and it was annoying as hell. The next multiplier is the number of users opening the dashboard. My refresh cycle is every 30 seconds, we have >30 machines and for the pilot phase 5 users let's say, that's 150 calls instead of 5 every 30 seconds.

 

I changed my approach to read the data only once and cascade it into the sub-mashups by Infotable parameters. It works and the network overhead is gone. I am almost happy. Please find attached two screenshots, the "fully rendered" shows an example with 21 machines, blurred because confidential data but I hope you get the idea. The "rendering" screenshot indicates the problem I have, the whole structure is rebuilding with each refresh every 30s. It does make sense as the collection widget does not know how many items it will receive, it's built to be dynamic but I don't need and don't want it in my case.

 

Long story short: Can I read the data only once per refresh without the collection widget rerendering every time?

 

I hope I am clear, let me know if you have questions. Thanks in advance.

Benny

Best answer by bmihaiciuc

Alright, I rechecked on a remote system and looked a bit into what's happening with the collection code. It looks like collection does indeed redraw the contents when you refresh the data.

 

It looks like the culprit is the PlaysIntroAnimation property that, when disabled, causes data updates to go through a code path that triggers a full redraw. Enabling this property should cause the data update to use the pre 8.4 behaviour which only updated cell contents, in addition to restoring the intro animation (which you may not want).

2 replies

5-Regular Member
July 7, 2020

Ensure that there are no duplicate values for the field you have selected as your UIDField. If you don't want the cells to disappear and then reappear, ensure that the values for that field are stable between updates.

BennyB16-PearlAuthor
16-Pearl
July 8, 2020

Hi @bmihaiciuc and thanks for your feedback,

yes, I can guarantee the values in UIDField are 100% unique and constant, it's the entity name of the machine. I am wondering if this could be related to my nested approach, I have InfoTables in my InfoTables and also another Collection in my sub-mashup.

 

Thanks

Benny

5-Regular Member
July 8, 2020

The nested tables shouldn't cause the issues in theory. Collection uses only the identifier to determine which item an entry refers to, regardless of where it comes from.

 

But just to be clear, how does the re-render occur? Do items just disappear and then reappear instantly, or is there an animation associated with this?

Support
July 13, 2020

Hi @BennyB.

 

This is a known issue that has been corrected in the latest release of the product, ThingWorx 9.0.  There are no plans to provide a patch level update to resolve the issue in 8.4.

 

Regards.

 

--Sharon

BennyB16-PearlAuthor
16-Pearl
July 14, 2020

Understood, thank you.