Stop the request on "preXhr.dt" (not on "preDrawCallback")

Stop the request on "preXhr.dt" (not on "preDrawCallback")

musinikmusinik Posts: 22Questions: 5Answers: 1

Good day!

I'm creating now a server-side export button.
I want ot modify the request, which is sent to server in preXhr.dt event.
E.g. I will clear the filters if I need to export the entire data without filters.

The basic concept:
1. click custom button, and set params for the export (e.g. all table OR current page), trigger fn.Draw().
2. On preXhr.dt check if any params are set, then we are exporting something, not just doing usual actions. If so, stop drawing.

Is it possible to do?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,971Questions: 1Answers: 10,160 Site admin

    You could use preDrawCallback (not preXhr - it doesn't have a cancel option). But I wouldn't recommend it. Just don't request the draw if you don't want it to draw.

    Allan

  • musinikmusinik Posts: 22Questions: 5Answers: 1

    Aha. Can you please tell me then, how do I get the same object as in preXhr event, which has all the details of the request being prepared?

  • allanallan Posts: 61,971Questions: 1Answers: 10,160 Site admin
    Answer ✓

    There is no option for that I'm afraid - sorry. As I say, the best thing to do is not to make the request in the first place.

    Allan

  • musinikmusinik Posts: 22Questions: 5Answers: 1

    Okay, thanks, allan!

This discussion has been closed.