How to handle DataTable order callback before drawing the table?
How to handle DataTable order callback before drawing the table?
collegewap
Posts: 2Questions: 1Answers: 0
I am aware of order event in DataTables. But it is triggered after the datatble is ordered. I am making use of server side rendering and I want to modify the request parameters before the Ajax call is made. Also, I tried making use of preDrawCallback. But preDrawCallback is getting called for pagination as well. I need to modify the parameters only if it is order callback. Kindly suggest how to do this.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
The
preXhr
event is triggered before the Ajax call - you may be able to use this.C
@colin But this gets called even for pagination. How do I identify it is sorting event?
Yep, but if you use that in conjunction with other events, as in this example, you can tell which event caused the load. It's a bit clunky, but I think it'll do the trick.
C