Search Builder "searchable=false" behavior seems wrong to me
Search Builder "searchable=false" behavior seems wrong to me
I have a datatables instance which uses both the standard search box which searches all columns (lets call it "Quick Search") and searchBuilder.
I have three columns that conflict with each other when using quick search. One is a department name, the next is a department hierarchy from the university level down to the department so it includes the department name and the third is a specific level within the hierarchy which represents a "school" which could also be the department for a given row. This results in "Quick Search" not working if you allow all three columns to be searchable. So I have disabled search for the hierarchy and the school with searchable=false but I allow the search to work across the department column with searchable=true.
Now that I have added searchBuilder I was happy to see the two "non-searchable" columns were still listed in the Search Builder list of columns. However when I base a search on one of these columns no data is returned. If I change the column to searchable and test again then searchBuilder works. So I think search builder is inconstantly honoring the searchable boolean. It either should not include the column in the list of columns you may base your search on or it should include the column in the list and should work as you would expect if that column is searched.
I prefer the later because "Quick Search" needs these two columns to be disabled since it is very basic and looks for data across all columns at the same time, but searchBuilder which addresses each column independently doesn't need to have search disabled and honestly I can't think of a case where you would want to disable a column in searchBuilder.
If anyone thinks it is necessary to be able to disable search on a column in searchBuilder then I think there needs to be two "searchable" booleans. One for the standard search and another for searchBuilder. Perhaps searchBuilderSearchable=false or something like that.
Answers
@sandy Just tagging you into this question since nobody else is replying. Thanks
I have a similar use case. Is there a way to separately choose columns for searchBuilder and the default search text input?
Hi everyone,
I have encountered a similar issue and fully agree with the points raised. Currently, the behavior of SearchBuilder seems inconsistent with the searchable parameter. It seems logical that non-searchable columns should not appear in the SearchBuilder list if searching those columns doesn't work.
The ideal solution would be to have two searchable parameters, one for standard search and one for SearchBuilder, such as searchBuilderSearchable.
This functionality would allow for more flexible and consistent search management, avoiding confusion for users. I hope the DataTables team can consider this proposal to improve the overall experience.
Thank you very much for your attention.