Three identical server side ajax requests when using SearchBuilder

Three identical server side ajax requests when using SearchBuilder

supermindsupermind 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

  • sandysandy Posts: 913Questions: 0Answers: 236

    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

  • supermindsupermind Posts: 27Questions: 5Answers: 0

    Great! I hope you'll find a way to minimize request count (to one) :smile: to avoid unnecessary traffic between client and backend server.

  • sandysandy Posts: 913Questions: 0Answers: 236

    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

  • sandysandy Posts: 913Questions: 0Answers: 236

    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

  • supermindsupermind Posts: 27Questions: 5Answers: 0

    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.

  • supermindsupermind Posts: 27Questions: 5Answers: 0

    @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 .

  • colincolin Posts: 15,177Questions: 1Answers: 2,590

    Thanks for that - I've tagged it for Sandy to look at when he's next in,

    Colin

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @supermind ,

    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.

    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

  • sandysandy Posts: 913Questions: 0Answers: 236

    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

  • supermindsupermind Posts: 27Questions: 5Answers: 0

    Super! Thank you for the fix once again! :smile: I tested this within my own app and it seems to work.

  • supermindsupermind Posts: 27Questions: 5Answers: 0

    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).

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

    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:

    • New: Styling changes to allow for Buttons closeButton in popover
    • New: Allow columns to be reselected using the origData property as well as the original data property
    • Update: Migrating to Fomantic-UI, which is a maintained fork of Semantic-UI, which is no longer being developed
    • Update: Use container option for Buttons popover align and span options
    • Fix: Fix issue with SearchBuilder not working with &
    • Fix: Fix compatibility issue between SearchBuilder and ColReorder
    • Fix: Fix error that occurs when searchbuilder has not yet been saved to the state
    • Fix: Make SearchBuilder set html rather than text for greater customisation
    • Fix: Fix small issue with value select element losing italics immediately after data selection made
    • Fix: Fix issue with empty arrays not being filtered correctly for array.equals
    • Fix: Fix issue with firefox not working nicely with array conditions
    • Fix: Reduce the number of calls to filterChanged when removing a condition
    • Fix: Array equals condition values should be comma separated
    • Fix: Improve Foundation styling integration
    • Fix: Semantic UI styling shouldn't have a border on the buttons
    • Fix: Stop error being thrown with numeric filter data
    • Fix: Reduce spacing when no title is set

    Allan

Sign In or Register to comment.