Change Search Builder Counting logic when using liveSearch false

Change Search Builder Counting logic when using liveSearch false

chocchoc Posts: 95Questions: 11Answers: 8

Link to test case: https://live.datatables.net/macahone/7/edit?html,js,output
Description of problem: Please check the test case I made using DataTables 2.0 and Search Builder 1.7.0.
I noticed this problem a long time ago and always thought that the default behavior (logic) of couting the criteria should be checked to see if it is valid or not (This means that 3 select fields (and input fields) are selected (or typed) before it is counted.

If I do nothing but simply clicking on the search builder button, it is still counted!
Click on the search builder button:

Close the window:

I would expect the text (1) not to be displayed as there is no valid filter yet, otherwise it would be misleading if I add 4 empty conditions but they don't actually filter anything. Especially if the Search button ( enabled by setting searchBuilder.liveSearch to false) and if I use the name Apply instead of Search (this means apply the filters).

IMHO I think this should be the expected default behavior (regardless of "liveSearch" true or false)

What do you think?


BTW, last month I have customized the style of the Search Builder with Flowbite (Tailwind), see the reply in here: https://datatables.net/forums/discussion/65775/integration-of-tailwind-css#latest

I also tried to change the source code to comply with the new counting logic (but it was too complicated and I couldn't get it to work), then I heard about the upcoming DT 2.0 release and the Search Builder refactoring (reply from https://datatables.net/forums/discussion/78023/bug-report-search-builder-search-button-event-fires-multiple-time#latest), so I wonder the roadmap of the Search Builder? I would like to apply the Flowbite (Tailwind) style for Search Builder, but I'm not sure if I should start now with Search Builder 1.7.0.

Preview of search builder with Flowbite styles from my reply to the discussion of https://datatables.net/forums/discussion/65775/integration-of-tailwind-css#latest:

This was made with this file (https://cdn.datatables.net/1.13.6/js/dataTables.tailwindcss.min.js) (no longer found) and I think I should start over with this file (https://cdn.datatables.net/2.0.0/js/dataTables.tailwindcss.js) ?

My idea is that when the Apply*** button is clicked, the search builder window is closed and the **valid criteria are counted and displayed in the button text as e.g. Filter (1) or Filter (2).

Replies

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

    Interesting point regarding the count - there is just an assumption at the moment that if there is a criteria shown, then it is a filter and should be counted. It doesn't check that it is actually applying a filter. I'll look at how easy it is to change that when I'm working on SearchBuilder in future.

    so I wonder the roadmap of the Search Builder?

    There isn't one as such. It will happen when I have time to do it - which will likely be some months in future due to other more pressing priorities. If I had a whole team working on this, things would be different, but I don't sadly. Perhaps if more people purchased Editor :).

    This was made with this file ( https://cdn.datatables.net/1.13.6/js/dataTables.tailwindcss.min.js ) (no longer found)

    It is still there?

    I think I should start over with this file ( https://cdn.datatables.net/2.0.0/js/dataTables.tailwindcss.js )

    Probably, assuming you want to use DT2 (which I would recommend).

    Allan

  • chocchoc Posts: 95Questions: 11Answers: 8

    Thanks Allan!

    Sorry for the link of https://cdn.datatables.net/1.13.6/js/dataTables.tailwindcss.min.js (I just have an additional parenthesis symbol in the url, silly me)

    But yeah, I will use https://cdn.datatables.net/2.0.0/js/dataTables.tailwindcss.js instead

    I will get back to you when I have completed something in the style of Tailwind for Search Builder based on DT2. Before that I just need to get familar with the new layout option

Sign In or Register to comment.