Is there a way to "simulate" pressing the refresh button to refresh a List? I have a list that I want it to update every 10 seconds. Is there a way to "press" the refresh button every 10 seconds?
My list name is ActiveJobsList. This is what I have at the moment:
export function autoRefresh() {
var counter = 10;
var id;
if(location.href.includes("activejobs")) {
id = setInterval(function() {
counter--;
if(counter < 0 && location.href.includes("activejobs")) {
// What should go here?
clearInterval(id);
}
}, 1000);
}
else if (!location.href.includes("activejobs"))
{
clearInterval(id);
}
}
I have created a component that provides a drop down menu for auto update setting. Here is the code and below it is an example of how to invoke it.
You could leverage React.Component.shouldComponentUpdate(), on your ActiveJobsList https://facebook.github.io/react/docs/react-component.html#shouldcomponentupdate
Okay so I managed to figure it out. I used
To figure out which button corresponded to the refresh button for admin-on-rest. In my case, it was the second button in the array.
Here is my updated code.