How to exclude columns for searchBuilder
How to exclude columns for searchBuilder

Link to test case: https://live.datatables.net/faxuzaza/1/edit
Debugger code (debug.datatables.net): NA
Error messages shown: NA
Description of problem: Hello,
1./ Customizing SearchBuilder
I would like to know what is the way to include/exclude columns for SearchBuilder component like it is possible to do with "columnDefs" and orderable / searchable options?
You can have a look to the test case. I saw in documentation that we can "force" columns to be used by searchPanes but in my case, I would like to allow all columns by default and exclude them by configuration.
2./ SearchPanes behavior
Also, is it normal that in my really simple example serachPanes does not show anything?
3./ SearchPanes styling problem
And to finish, if you open searchBuilder pane you can see that it is contained into the red box (body)
If you open the searchPanes pane, you can see that it is shifted to the right (due to padding / margin of the body in the css)
Is it a small bug or not?
Thanks in advance for your answer and have a nice day.
This question has an accepted answers - jump to answer
Answers
Use
searchBuilder.columns
. I uncommented"columns": [1, 2, 3]
you have for the SearchBuilder config and it works. Maybe I'm not understanding the question.Yes. SP uses a ratio of unique values to determine if the pane should be shown. Read about the details in the
searchPanes.threshold
docs. Yu can either adjust the ratio or usecolumns.searchPanes.show
to display the pane.Updated test case:
https://live.datatables.net/rigubavi/1/edit
I'll let @allan comment on this. Probably needs adjustment to the applied CSS.
Kevin
Hello @kthorngren,
I commented out this line intentionally to show that I had read the documentation
As I said, I don't want to choose columns by inclusion but by exclusion (indeed, it's often simpler to exclude the last column than to have to list all the columns to include, especially across multiple tables that don't necessarily have the same number of columns).
Thanks for the tip, I haven't seen it
If the columns have classes then you could use the
:not()
pseudo selector:Or I suppose for column indexes:
Regarding the styling error - yup, something wrong there that I need to look into! Thanks for the test case.
Allan
Hello @allan,
Thansk a lot, it works very well with class selector
I have done another test case if you want to have a look.
You will see the behavior of searchPanes (or searchBuilder) when it is on the right.
https://live.datatables.net/qoyijezu/1/edit
I hope you will be able to fix it in the next release