134
Views
6
Comments
Counter refresh
Question


Hello

In a task list there is a field where I check if a task is already done. Associated with this list, there is a counter visible in the header of the page. When adding or removing a task, the counter only changes when I refresh the site. Is there any way to refresh the counter without having to refresh the page?

Thanks


2019-05-22 11-30-09
Marcelo Ferreira

Hi Carlos,

On the screen action that add and delete the task from the list you need to Ajax refresh the container of the counter.

Regards,

Marcelo

2019-06-05 10-23-58
Andres Moreno

Carlos,

Are you wanting to refresh the counter when there is an action taken outside of you current page?

if that is the case you will need to implement websockets.

Here is a forge component that uses Pusher.

https://www.outsystems.com/forge/Component_Overview.aspx?ProjectId=4339&ProjectName=pusher-channels-demo

2020-07-21 19-28-50
Rajat Agrawal
Champion

Hi,

Create one container with some name like countercontainer, place that counter inside the container. Just use Ajax refresh from widget and assign countercontainer to the widget.

Thanks,

Rajat Agrawal

UserImage.jpg
Carlos Messias


I use a server action in the logical processes that refresh  the counter.
The idea is to be able to refresh using the action preparation of the webblock of the counter located in the header of the site.




2020-07-21 19-28-50
Rajat Agrawal
Champion

HI Carlos,

As per my understanding you have Counter web block in the header of your page. You want to refresh that web block based on the logic in preparation of web block. 

Now what you can you do it, just call notify widget in the web block preparation and pass any value you new value or any value you want to pass counter 


Just for example, I have kept countercontainer in Breadcrumb, you can keep according to your requirement 


Now call on notify action of a web block, where you can read message from web block preparation and assign value then use ajax refresh.




Thanks,

Rajat Agrawal

2021-03-05 13-56-11
Ricardo Pereira
 
MVP

Hi Carlos,

If you work with version 10, you can use Rajat solution.

If you're working with version eleven, you can work with the events and the handlers. You can create an event in the web block, and create an action in the parent to be the handler (in there you do what you need to do):


If you want to use Rajat in version 11 you can do it, but it's deprecated. 


Best regards,

Ricardo

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.