I’m looking for a way to be able to refresh a block by clicking on a button. Ideally, it would be great to utilize a top bar action button; however, a custom-code block with a button could also work.
I have various refresh and reload scenarios by calling a whole page refresh but I’d like the ability to call an individual block reload by clicking a refresh button.
Being able to check a table block for new line items would be great without having to refresh the entire page. I’m fairly confident it’s doable since we have the reload code (see below), i’m just not sure how to call it with a button.
Everywhere you see #table1 => change it by the right # (ID/name) of your table block
window.addEventListener('block-loaded-table1', function () { is important as several Softr team members pointed that it would make everything more efficient while running a script linked to a block (specifically a reload block event)
This line is to consider carefully:
#table1 .MuiButtonBase-root:nth-child(2)
In my example, I placed the refresh button in the second position in top bar buttons (there is one button before it. That’s why I use :nth-child(2). If the refresh button is the first => #table1 .MuiButtonBase-root:nth-child(1)
Is there any tweaks to the code we could do to refresh a list block without refreshing the whole page? I’m looking to create a swipe-down to refresh, if possible? thanks in advance (data connected to airtable)
Additionally, is there any way to have users view live data?
E.g there are two separate users:
User A - Creates a new record (data connected to airtable) on a list block > user see’s new record displayed on softr (this already works great)
User B - Is viewing the list block (I would like the new record created by user A to show automatically to user B)
Yes there would be a way to refresh a list block without refreshing the whole page. What would the exact use cae (please describe how - ideally - a user would act)
There would be a way for users to see live data.
That being said, I won’t disclose this (0 chance ) as:
I don’t know if it still works due to recent Softr updates.
It might overload the Softr app pretty quickly.
As a consequence it needs to be extremely well setup.
Some future datasources have this realtime data feature = Supabase for example. It is way better to run such things from the back-end and not from the front-end.
Think instagram when we pull down the feed page, it refreshes the feed with new posts - is essentially what I’m creating using ‘List with vertical cards and tag’ with the name ‘community-feed’
I currently have a top tool button (1) as an onclick refresh with a loading screen active as the page reloads
however, ideally, I would like the refresh button to be hidden for mobile users and have them swipe down to refresh the page and have the list refresh - not the page
Haha that makes sense no worries! hopefully with the above would be the workaround!