|
Refresh view
Started by: Puntorosso
in: Toolset Professional Support
Quick solution available
Problem: If no items are found in a View of WooCommerce Orders, I would like to automatically refresh the View results after a set amount of time.
Solution: There is no automatic feature for refreshing View results, nor is there a true JavaScript API for Views, but you could achieve something similar by reloading the current page in a setTimeout function added to a script tag in the wpv-no-items-found block of the View, for example:
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
<script type="text/javascript">setTimeout(function(){location.reload();}, 5000);</script>
[/wpv-no-items-found]
This will reload the current page after 5 seconds if no results are found in the View. That loop of refreshing every 5 seconds would continue until results exist.
Relevant Documentation:
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Timeouts_and_intervals
|
|
2 |
3 |
3 years, 4 months ago
Puntorosso
|
|
Toolset View – Infinite scroll not working
Started by: Paul Marconi
in: Toolset Professional Support
Quick solution available
|
|
2 |
7 |
3 years, 5 months ago
Paul Marconi
|