How to handle DataTable order callback before drawing the table?

How to handle DataTable order callback before drawing the table?

collegewapcollegewap Posts: 2Questions: 1Answers: 0
edited March 2018 in Free community support

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

Answers

  • colincolin Posts: 15,235Questions: 1Answers: 2,597

    The preXhr event is triggered before the Ajax call - you may be able to use this.
    C

  • collegewapcollegewap Posts: 2Questions: 1Answers: 0

    @colin But this gets called even for pagination. How do I identify it is sorting event?

  • colincolin Posts: 15,235Questions: 1Answers: 2,597
    edited March 2018 Answer ✓

    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

This discussion has been closed.