Handling updated data render in living applications with setTimeout() and/or a delayed refresh

Hi all,

In Living Applications made with Bonita UI Designer, where you have a button widget that starts a process that changes some data that is displayed on the application page but takes a couple of seconds to complete, what’s a good way to reload that data after a delay (or otherwise watch for changes)?

I’ve tried having a JavaScript snippet in a $data variable that uses a JS setTimeout() function, and this successfully can update other $data variables to in turn make business data reload, but until the user clicks some other control, the updated data isn’t rendered.

I think this is because the setTimeout function updates the relevant other $data variable outside of what the Angular framework can see, which googling around tells me that a $scope.$refresh() call should cause it to update - but $scope isn’t available to the JavaScript code for a variable.

Has anyone made this work some other way?

I’ve attached a UI Designer page that demonstrates the issue (compare the displayed value of testvar vs what’s printed on the console log). This demo depends on a custom widget “ScriptButton”, also attached.

page-Playground2.zip (210.0 KB)

widget-ScriptButton.zip (2.6 KB)