Open on46zohu opened 3 months ago
Oh nice, thanks for sharing! Well I see that datatables has a column visibility button - I've not tried it yet but maybe you could use that, and hopefully the integration with the search builder would work better?
Thanks for the link! Maybe a dummy question, but I haven't used any extension directly from DataTables.
How to, for example, add the column visibility button extension (which is no Python code) to the show() call below?
show(df,
layout={"top1": "searchBuilder"},
)
Hi @on46zohu , sure I've had to add the column visibility button in the package. It's available in itables==2.1.1
and documented here, let me know how it works for you.
Hi @mwouts. It works great, thanks a lot for the quick addition! Just one note: The below show() call works just fine, but if you add the following parameters, the search builder becomes unresponsive: column_filters=False, searching=False
My intention was to remove the search option, which I never use: https://mwouts.github.io/itables/advanced_parameters.html#search
But instead, I added pageLength to the layout, where normally the search option is located.
Hope it helps somehow!
show(
df,
column_filters=False,
searching=False,
columnDefs=[
{
"targets": [0,1,2],
"visible": True,
},
{"targets": "_all", "visible": False},
],
buttons=[
{
"extend": "colvis",
"collectionLayout": "fixed columns",
"postfixButtons": ["colvisRestore"],
},
],
layout={
"top1": "searchBuilder",
"topEnd": "pageLength",
},
language={
"buttons": {"colvis": "Columns"},
},
)
Due to a need of higher interactivity, I've integrated a simple checkbox mechanism to the show() function so that the user can show/hide the columns preferred (as below).
But the thing is, each time I add a condition using the "Custom Search Builder", and then select/deselect a checkbox, the search builder resets, and the filters I set disappears.
Of course, I do not expect you to improve/fix my code, but wanted to ask if you could suggest anything to better handle this issue. In addition, do you have any plan to implement any similar built-in extension in itables in the near future? Thanks!