Skip Navigation

[Resolved] Update views results

This thread is resolved. Here is a description of the problem and solution.

Problem:
The user would like to refresh a view's results for each 5s.

Solution:
That's not available out of the box, but it can be done with a simple workaround.

  1. Add a search part to the view, that has a submit button.
  2. Make this search part hidden using CSS.
  3. Add a custom Javascript code to the view that will trigger a submit button after 5s.

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/adding-custom-javascript-code-to-views-that-use-ajax/

This support ticket is created 3 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 5 replies, has 3 voices.

Last updated by kostasO 3 years, 8 months ago.

Assisted by: Jamal.

Author
Posts
#2098185

Hi, I wand to trying to auto update a views result after a time period of 5 sec in a page without reload.

I have set up the pagnation to be in
Pagination enabled with automatic AJAX transition
Show Each Page For = 5sec

but i do not get an update

how can i do that ?

thanks

#2098849

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

You want to "auto update a View result" after 5 seconds.

You mean that the View should refresh after 5 seconds?

That doesn't sound the same as auto-paginating after 5 seconds, because that would move from page one of the query results to page two of the query results after 5 seconds (even if you are showing only one result at a time).

But you want page one to refresh after 5 seconds, is that right?

I want to clarify what you aim to do before suggesting a solution.

#2099893

Hi Nigel,

I have made a support page that a user can ask a question with a custom type called question and some text fields (name, question e.t.c)
I have created a view that presents all these questions and gets a parameter from the URL that reads the department of the question and display them a simple unsorted list

What i need is to create a page the will display that view and it will automatically updated to present the latest question in the top each 5 seconds. so the tech department that is active at the moment can see the question immediately when posted and respond as soon a possible.

So i would need some help on how i get do that ?

thank you in advanced

#2099961

Hello there! If you don't mind, I'll continue with you on this ticket.

Well, you want to refresh the page each 5s, and not paginate. That's not available out of the box, but it can be done with a simple workaround.
1. Add a search part to the view, that has a submit button.
2. Make this search part hidden using CSS.
3. Add a custom Javascript code to the view that will trigger a submit button after 5s.

Depending on how you are building the view(using the legacy or the blocks editor), the implementation may differ. Let me know what editor you are using and I'll give more details on how to implement it.

Or allow me temporary access to your website, let me know where the view is visible, and I'll give you the exact solution. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#2102235

Hi Jamal,

Thank you for your great advice. I made it 🙂

greate advice, thanks

best
kostas

#2102237

My issue is resolved now. Thank you!