Skip to main content
15-Moonstone
June 24, 2022
Solved

refresh widgets

  • June 24, 2022
  • 1 reply
  • 1351 views

Hello, I'm filling a list widget with some data and noticed that the widget itself does not show updated data while the code executes. some console.log show that is not a matter of data updating but the widget needs a graphical refresh (e.g. click on the screen) to be refreshed and show correct data. My question is: how to perform a forced refresh of the widget from the source javascript code?

 

Thank you!

Best answer by RolandRaytchev

depending on widget type could differ. The simple thing is after setting some properties to call:

$scope.$applyAsync()

some time  is better

$scope.setWidgetProp("widgetname","prop", value)
//better as setting the property $scope.view.wdg['widgetname']=value
$scope.$applyAsync()

or call it inside $timeout construct

for some other widgets like charts , possibly we need a extra update method like:

$scope.app.fn.triggerWidgetService("timeSeriesChart-1","updateChart");

so if this mention above does not help, please, provide simples example to reproduce and understand the issue. Thanks

 

1 reply

21-Topaz I
June 24, 2022

depending on widget type could differ. The simple thing is after setting some properties to call:

$scope.$applyAsync()

some time  is better

$scope.setWidgetProp("widgetname","prop", value)
//better as setting the property $scope.view.wdg['widgetname']=value
$scope.$applyAsync()

or call it inside $timeout construct

for some other widgets like charts , possibly we need a extra update method like:

$scope.app.fn.triggerWidgetService("timeSeriesChart-1","updateChart");

so if this mention above does not help, please, provide simples example to reproduce and understand the issue. Thanks

 

GianVal15-MoonstoneAuthor
15-Moonstone
June 24, 2022

"$scope.$applyAsync()" correctly worked, Anyway, as usual, I could not find comprehensive documentation about methods, API, etc. It could be very useful

 

Thank you