[Bug report] Search Builder search button event fires multiple time

[Bug report] Search Builder search button event fires multiple time

chocchoc Posts: 101Questions: 12Answers: 9

I noticed that the click event of search button (with searchBuilder.liveSearch set false) fires multiple time.
Since the line this.dom.search.unbind('click'); is missing. (see: https://github.com/DataTables/SearchBuilder/blob/master/src/group.ts#L498)

And since the searchBuilder.liveSearch is set false,
The count filter event should also only be updated when the Search button is clicked.
See: language.searchBuilder.button

And I think the filter count should only count those with the fulfilled condition (filled criteria), but currently the count is added whenever the Add condition button is clicked

It seems that the function checkFilled() in https://github.com/DataTables/SearchBuilder/blob/master/src/group.ts#L574
is not used for checking?

This may affect many parts of the source code, so I'm not sure if this will be in the roadmap, which only updates the count when the condition is met (criteria filled) and after clicking the search button.

Thank you!

Replies

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin

    I've committed the change for the missing off/unbind. Thanks for letting me know about that.

    The rest, I'll need to look into a bit more - there are parts of the code that are unnecessarily complex and could do with a little refactoring.

    Allan

Sign In or Register to comment.