Refresh list on component tap

Hi there, I have a list of yoga classes displayed on a screen.

I wanna add days of the month as buttons to the screen above the list, and when the user taps on any day of the month, the list will filter accordingly.

How do I trigger an action to refresh the list based on the day the user taps on?

Here’s a sample video of what I’m trying to achieve:

If there’s any better way to achieve this, please share.

Thank you in advance!

How are you initially populating the list? Some kind of variable or an API call?

Hey @Bryony, I’m populating the initial list using a data variable.

I actually managed to figure it out :joy:

I needed to set a page variable “day” and bind the button to the page variable. Every time a user taps on any given day, the page variable will change.

The list of classes below is also bound to the page variable, so when the “day” changes, the list also changes.

Only issue is that every time I tap on the day, it takes about 5 seconds for the page to refresh.

Not sure if it’s something I can control, but the latency is ridiculously long. Maybe it’s got to do with a built-in delay of 5 seconds or something before the data on the same screen refreshes?

You can change the logic of the data variable polling time:

If you just change that ‘Delay 5000 ms’ to what you prefer. Personally I don’t use this because I find it’s high-load on my APIs so I just trigger a manual refresh of my page variables when I need to but yeah, you should be able to reduce the latency this way. Hope this helps!

1 Like

Hmmm, the initial load is quick, just that when it switches, the delay is almost always 5 seconds…

Here’s what I mean:

Thanks so much for your help, btw!

Hi @Harri_Sarsa any idea? Thank you in advance :slight_smile:

Can anyone point me in the right direction, at least, please? Thank you :slight_smile:

If you move your refresh logic to the page canvas, you can add a Receive event node with name like “Refresh data” and trigger it via the Trigger event node! (There’s a bug that prevents custom events from being triggered on the data variable logic canvas, so you need to do the logic on the page logic canvas, or the global canvas.)

Hey @Harri_Sarsa, I don’t quite understand what you mean… Maybe if you take a look at this demonstration, you’ll know what I’m asking about:

Thank you

If I’m correct, there’s an answer for this here.