Hi,
I have an igTreeGrid where a subset of the rows have a timer, ticking down to 0. The way I have implemented, I have called
setInterval(tickExpirations, 1000)
Inside the tickExpirations function, I essentially compare the current system time with an expiration time, take the diff, create a string ("00:02:00"), and update the igTreeGrid using updating feature. Then I call commit. This is being done for all rows that need updates to their timer.
However, this is causing the page to be slow or unresponsive if there are many timers.
Can you please advise if there is an alternate way to update the grid that is not as expensive? I've uploaded screenshot of Google Chrome profiler.
Thanks!
Hello C R,
Note that if you modify directly the dataView() the related DOM elements in the grid would not be updated with the changes out of the box.Are you perhaps calling the dataBind() method on each update? That re-renders the whole grid so it would not be recommended to call it too many times on a timer.
Let me know if there’s anything else I can help you with.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://ko.infragistics.com/support
Hi Maya,
I found a workaround for the issue. Instead of updating the dataSource and calling commit, I am instead modifying the dataView directly. The dataView returns an array of objects, and I just modify the properties representing the timer. I profiled in Chrome, and see a big performance gain.
I'll keep you updated.
If you could share a small sample that demonstrates the exact scenario or some code snippets of the relevant code I might have some additional suggestions.
Let me know if there’s anything else I can help you with in the meantime.
Thanks for your input, I noticed I was calling commit on every row change. Now I am just calling commit once on every call to tickExpirations. As a result I was able to gain some performance.
Still looking at other ways to squeeze performance.
From the description you’ve provided it sounds like only about 10 records are being updated in a second which should not cause a big delay.
I’ve created a small sample with a similar setup where on each second 10 out of the 20 records get updated, however I didn’t notice any performance issues. I’ve attached it for your reference.
Could you check if perhaps your tickExpirations function is called more times than you expect or if more records are being updated in your scenario?
If you can share a small sample that demonstrates the exact scenario that would also help.