cancel
Showing results for 
Search instead for 
Did you mean: 

Widget refresh

Lisha
8 - Cloud Apps
8 - Cloud Apps

Hello,

I have added a widget script which performs my required action and at the end I want to refresh the widget.

Everything is working fine but the widget keeps on refreshing again and again. Is there a way to limit this so the widget is refreshed only once after the result is processed.

Below is the structure of the script used :

widget.on('processresult', function(widget, query) {

. .

. . 

. . 
widget.refresh();
});

 

3 REPLIES 3

Harry
9 - Travel Pro
9 - Travel Pro

Hello @Lisha ,

The 'processresult' event executes before the chart renders. So normally refresh is does not required in this event. Can you explain what action you are performing in 'processresult' event?

Always here to help,
Harry from QBeeQ
harry.km@qbeeq.pl
www.qbeeq.pl

Lisha
8 - Cloud Apps
8 - Cloud Apps

Hi @Harry 

I am changing the indicator color based on some specific conditions.

This has to be done using a script (and not via provided color formatting within widget) since it is a complex logic.  

Lisha_3-1666012724781.png

What I noticed is, if I refresh the specific widget manually or add widget.refresh() in the script it displays the correct color.

Otherwise, it just updates the color within the indicator (color options) but does not reflect it on the widget unless widget is refreshed.

Lisha_2-1666012623893.png

As you can see above, in the left color panel the correct color for this condition i.e. orange is updated but the widget still shows green.

Harry
9 - Travel Pro
9 - Travel Pro

Try below script to change color

ev.result.gauge.color = 'green'

Example:


widget.on('processresult',function(se, ev){

  var value = 5
  
  if(value > 5 )
  	ev.result.gauge.color = 'green'
  else 
	ev.result.gauge.color = 'red'
})

Always here to help,
Harry from QBeeQ
harry.km@qbeeq.pl
www.qbeeq.pl