Three identical server side ajax requests when using SearchBuilder
Three identical server side ajax requests when using SearchBuilder
supermind
Posts: 27Questions: 5Answers: 0
Link to test case:
http://live.datatables.net/gihuqawi/1/edit
When enabling SearchBuilder (Q in 'dom' property) DataTables makes three identical ajax requests to the server. Without QueryBuilder, only one request is made. I found this problem debugging why my initial table reload is so slow on huge datasets. With smaller data sets where database don't choak this is not an issue.
Any ideas how to fix this?
Replies
Hi @supermind ,
Thanks for pointing this out. When using client side processing these are all certainly required, but it may be possible to remove some of them when using server-side processing. I've raised an issue internally (DD-2429 for my reference) and will report back here when there is an update.
Thanks,
Sandy
Great! I hope you'll find a way to minimize request count (to one) to avoid unnecessary traffic between client and backend server.
Hi @supermind ,
That should be the issue fixed now as you can see at this example. This will be available in the next SearchBuilder release which we hope will be in the next few weeks. Until then you can access the fix from the nightly builds.
Thanks,
Sandy
Just to note here for anyone else who stumbles across this thread...
The examples above do not apply any filtering to the table, they only demonstrate the number of requests that SB makes when using SB and
stateSave
. The live site doesn't have a script that is set up to allow for SB SSP, so this one has been used instead purely to demonstrate that issue.Thanks,
Sandy
Thanks for the fix! I referenced to the nightly version of SearchBuilder and tt worked well to certain point and I saw only one request sent to server.
However, when state is saved, no
"searchBuilder": {}
element is found in the JSON and I think this causes error when loading the state back again. Error is "dataTables.searchBuilder.js:3193 Uncaught TypeError: Cannot read properties of null (reading 'searchBuilder') at HTMLTableElement.<anonymous> (dataTables.searchBuilder.js:3193:75)".This is my initial finding and I will dig deeper. Just to let you know that I faced problems with this build while not making other changes in my code so I think something might be broken in the nightly build.
@sandy I can confirm that something went wrong with your fix. If you delete saved state from browsers LocalStorage and refresh the page, you'll see that data is not loaded and JS error is thrown. You can use your own live demo to see this: http://live.datatables.net/davocade/1/edit .
Thanks for that - I've tagged it for Sandy to look at when he's next in,
Colin
Hi @supermind ,
Thanks for pointing that out. I've raised an issue internally (DD-2434 for my reference) and will report back here when we make a fix.
Thanks,
Sandy
Hi @supermind ,
That should be the issue fixed now as you can see at this example. This will be available in the next SearchBuilder release which we hope will be in the next few weeks. Until then you can access the fix from the nightly builds.
Thanks,
Sandy
Super! Thank you for the fix once again! I tested this within my own app and it seems to work.
Hi again! Is this fixed in release v1.3.1?
I could not find release notes for latest release in CDN (latest version at https://cdn.datatables.net/#SearchBuilder is 1.3.0).
Sorry - I haven't rebuilt the release notes files for the CDN yet. The JS/CSS files are there for 1.3.1, but not the releases notes yet. This is a copy of them:
container
option for Buttons popover align and span optionsAllan