SearchBuilder Delete Condition Bug

SearchBuilder Delete Condition Bug

mooncoffeemermaidmooncoffeemermaid Posts: 3Questions: 2Answers: 0

Good day,

I was wondering if someone could help with a bug I'm experiencing with deleting an empty/not empty condition.

To duplicate this problem:
1. Navigate to https://datatables.net/extensions/searchbuilder/examples/performance/searchBuilder50k.html
2. Press "Add Condition"
3. For the "Data" dropdown choose "Name"
4. For the "Condition" dropdown choose "Empty"
5. Press the "x" to delete the filtering rule (The table will not reflect the change and the filter will not be completely cleared)

Link to test case: https://datatables.net/extensions/searchbuilder/examples/performance/searchBuilder50k.html
Debugger code (debug.datatables.net): Problem is re-producible following provided steps on searchbuilder example.
Error messages shown: Uncaught TypeError: Cannot read properties of undefined (reading 'off')
at c.destroy (dataTables.searchBuilder.min.js:25:152)
at HTMLButtonElement.<anonymous> (dataTables.searchBuilder.min.js:119:445)
at HTMLButtonElement.dispatch (jquery-3.5.1.js:5429:27)
at elemData.handle (jquery-3.5.1.js:5233:28)
Description of problem: When deleting an "Empty" or "Not Empty" filter condition from the search builder the error above is thrown and the table does not work until refreshed or Clear All is pressed. (If using stateSave, refreshing results in the conditions coming back)

Does anyone know of a solution for this?

Answers

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

    Thank you for those steps on how to reproduce - I agree, something is definitely wobbly there. I've raised it internally (DD-2571 for my reference) and we'll report back here when there's an update.

    Cheers,

    Colin

  • ericscalesericscales Posts: 2Questions: 0Answers: 0

    FYI - This is still happening. I noticed it occurring with a custom condition I created and the same issue with the example noted above. This appears to be the code firing off the exception (I'm guessing because that element doesn't exist in the case of an "Empty" condition or similar?):

        w.prototype.destroy = function() {
            this.dom.data.off(".dtsb"),
            this.dom.condition.off(".dtsb"),
            this.dom.delete.off(".dtsb");
            for (var t = 0, i = this.dom.value; t < i.length; t++)
                i[t].off(".dtsb");
            this.dom.container.remove()
    
  • ericscalesericscales Posts: 2Questions: 0Answers: 0

    @colin to check and see if this is still on the radar.

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    Hi,

    Apologies this one did slip off the radar. It is fixed now and SearchBuilder 1.4.2 has just been released with the fix.

    Regards,
    Allan

Sign In or Register to comment.