I’m updating a somewhat complicated and very intertwined script that is a page with a bunch of tables with data in them. It’s basically built on using setInterval function to update the data on the page. There is a refresher function that makes cascading ajax calls to function after function. Each function call basically builds a new table with updated data and displays the new table on the main page. There isn’t any issue to me with that inherently except I’m tasked with adding new features to the table, like checkboxes for each row in the table and a modal that can pop up and do different things. The problem I’m facing is that every time the setInterval is called it both clears the checkboxes and removes all of my previously created event handlers. One option is that I can pause the setInterval every time a checkbox is selected or a modal is selected but that creates a different issue which is that if the user checks a checkbox and then forgets about it the data won’t update. In any case I’m wondering if there’s a better option than using the setInterval, I can refactor the page, but I haven’t found another option that might work. If there’s not a better option is there some way to work within the restraints of setInterval that anyone has dealt with before??
Sorry I know some of this is kind of vague and I’m happy to show some code examples if that would be helpful. Thanks for any input and guidance!