I'm using style_data_conditional to hide columns in a data table. Works!
But when adding
filter_actions='native'
the rows will be like
|c1|c2|c6|c7|
filterfilterfilterfilterfilterfilterfilter
(this row is longer than the table because the display:None isn't applied)
|1|2|6|7
Versions:
dash==1.13.4
dash-auth==1.3.2
dash-bootstrap-components==0.10.7
dash-core-components==1.10.1
dash-extensions==0.0.31
dash-html-components==1.0.3
dash-renderer==1.5.1
dash-table==4.8.1
Here is code to reproduce the DataTable
import dash_table
import dash
import dash_html_components as html
import pandas as pd
app= dash.Dash(__name__)
df=pd.DataFrame([
[1,2,3], [1,2,3],[1,2,3]
],
columns=['1','2','3'])
app.layout = html.Div([
dash_table.DataTable(
data=df.to_dict('records'),
columns=[ {"name":i,"id":i } for i in df.columns],
style_table={'padding-right':'2rem',
'padding-left':'2rem',
'padding-bottom':'1rem'
},
page_size=14,
row_selectable="single",
page_action='native', #front end
# sort_mode='single',
sort_action='native',
editable=True,
filter_action='native',
style_data_conditional=[{'if': {'column_id': '2',},
'display': 'None',},],
style_header_conditional=[{'if': {'column_id': '2',},
'display': 'None',},]
),
])
if __name__ == '__main__':
app.run_server()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…