Enable state saving makes the ajax Datatable perform 2 request to server of consecutives draws
Enable state saving makes the ajax Datatable perform 2 request to server of consecutives draws
Hi, before all, thank u for this great plugin. I'm using state saving on an ajax datatable with many configurations and backend retrieved columns and plugins, that's why it's hard to post an snippet, and it's having this strange behavior. When I refresh page DT data is requested twice but not the same draws. Ex. if the current draw is 1, then performs 2 requests, one for draw 1 and other for draw 2. The curious is if I set stateSave to false, the problem disappears. I tried to debug it but is a long call stack. I'm using local storage to save the state. If anyone have faced the same issue and can help me to find out which is causing it would be very appreciated.
Answers
Hi @jpujol ,
This very simple example here shows that it does only make a single request, regardless of the sorting, filtering or page location, so it's very likely to be something in your initialisation that's causing it.
It would be interesting to know what the two draw requests are? Are they for the same data, or different?
Cheers,
Colin
Thanks @colin for ur quick answer, is the same data in both draws, I agree with u, must be something on initialization.