draw event fires too many times with cascadePanes:true option on SearchPanes
draw event fires too many times with cascadePanes:true option on SearchPanes
Link to test case:
With searchPanes.cascadePanes
enabled:
http://live.datatables.net/pedakowe/71/edit
Without searchPanes.cascadePanes
enabled:
http://live.datatables.net/rozoxina/1/edit
Description of problem:
draw
fires 10 times with searchPanes.cascadePanes
enabled when selecting a filter:
and deselected it fires 6 times:
But with searchPanes.cascadePanes
disabled it fires only once on select and once on deselect.:
Selected:
Deselected:
This is a problem, because with 57 table rows and only one graph as in the examples that I have given, nothing happens.
But if they are larger tables and more than 2 graphs, it will take a long time to display the graphs, since with cascadePanes:true it will redraw the graphs 10 times...
This question has an accepted answers - jump to answer
Answers
With
searchPanes.cascadePanes
enabled:http://live.datatables.net/pedakowe/71/edit
Without
searchPanes.cascadePanes
disbaled:http://live.datatables.net/rozoxina/1/edit
Can someone help me. Sorry for posting with this message, but I usually wait 10 days to post if I don't get a reply.
Hi,
You are correct - when using cascade in SearchPanes, it will do a bunch of redraws since it needs to calculate each level of the panes, and it does that by filtering the table (which in turn is triggering a draw).
We don't yet have a better mechanism for this - it is something that would be useful though, as it can cause issues such as that which you are seeing.
For the moment I would suggest using a debounce in your event handler to buffer the draws into a single call to your charting draw.
Allan
Hi and thanks @allan .
Ok, that's what I thought. As a suggestion (from the total ignorance of Datatable programming) a new event would be fine, but only to be called with the redraw of the table.
On the other hand, is there a way to calculate how many times
draw
will be called based on what filters you have enabled? And how manydraw
calls are added by the differentSearchPanes
options.No, I'm afraid not. Well, not without going through the SearchPanes algorithm anyway. I reckon a 100mS debounce would be best.
Allan
Thanks for the quick response @allan .
I'll try it and depending on what I get, I'll post the code in this thread for the rest of the community.
Is there any news regarding this?
WEE totally want better performance for cascades and viewTotal
Yup - me too . I think I'm going to have to rework the SearchPanes algorithm. I can't say when that will happen, but I think a SearchPanes 3 is going to be called for.
Allan