HTML snippet is not getting refreshed on next page click

Hi All, I have written some custom javascript code in HTML snippet which I want to be get executed when page loads. It is working fine but when I click on the next page in data grid control panel, this code doesn’t re execute. So expected changes are not reflecting after next page click. I looking for a solution through which I can just call either this snippet itself or a microflow. Please help me if you have any solution. Thanks
2 answers

Using settimeout function in javascript  you can run the CSS  code continuously to update and change the style.

setTimeout(() => document.getElementsByClassName("mx-name-container1").style.backgroundColor ="green");


The solution provided with setTimeout() / setInterval() is a JavaScript workaround which is not really recommended. Why not add an on click event handler to the pagination buttons?


You can target these buttons with the HTML snippet once the page is loaded and based on the CSS class you can give in Studio Pro to the datagrid, those pagination buttons can be retrieved with plain JavaScript like document.getElementsByClassName. Once retrieved add the on click event handler. On click run the code you are also running on page load.