$.fn.dataTable.util.throttle not throttling search (server-side)
$.fn.dataTable.util.throttle not throttling search (server-side)
jrizzi1
Posts: 44Questions: 12Answers: 3
In my example, I have throttling set at 2500, which should throttle requests to 1 every 2.5 seconds, however I am seeing no throttle occurring, it is sending a request every keyup , same as before I included the throttle method
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Thanks for moving this over from GitHub. In your example you use the throttle utility function to create a throttled function assigned to the variable
search
:Which is fine, but you never use it. Instead the code goes on to do:
which does exactly what it is told to do - perform a search on every keyup and change event.
What you need to do is wrap that inner function in a throttle and use that in the event handler. Something like:
http://live.datatables.net/laxinabe/5/edit
Note that there is a bug in DataTables at the moment whereby the throttled function will execute immediately and then delay kicks in. That is something I will address in the next release.
Allan
thanks Allan, much appreciated
Hi Allan,
Was wondering if there is any update on this issue.
Thanks
Regarding my latest statement for the above post? Sorry, haven't had a chance to look at it yet with everything else going on.
Allan