How to cancel previous AJAX calls in DataTables

How to cancel previous AJAX calls in DataTables

plazavplazav Posts: 6Questions: 2Answers: 0

Dear community and moderators!

I know that there are a lot of posts on this forum and on Stackoverflow.
But there are still no clear answer of how it could be possible to cancel currently call.
I will describe my current situation: When I type search text in input field - it could happened that search order would be wrong. And I will receive result without last entered letter. I have set "searchDelay": 1000, but it doesn't help.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @plazav,

    This thread here may help, the proposed solution helped @JonnyEggins. Can you try that, please, and let us know if it works.

    Cheers,

    Colin

  • plazavplazav Posts: 6Questions: 2Answers: 0

    Thank you, @colin !
    I have seeing this. But have no idea where does he has put

    table.settings()[0].jqXHR
    
  • kthorngrenkthorngren Posts: 21,300Questions: 26Answers: 4,945
    Answer ✓

    This thread has an interesting solution using debounce. Take a look at the last two posts.

    Kevin

  • plazavplazav Posts: 6Questions: 2Answers: 0
    edited April 2018

    This js allows to add button and start search only after button click or enter.
    Link to demo
    I have decided to use it.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    @plazav : nice, sorry, I missed your original reply, but that looks like a good solution :)

This discussion has been closed.