Hi everyone,
I have prepared a dashboard. Where I have a dash datatable.
df is the dataframe from excel file
html.Div([
dash_table.DataTable(
id='data-table',
data=df.to_dict('records'),
columns=[{'id': c, 'name':c} for c in columns],
filter_action="native",
fixed_rows = {'headers': True},
style_cell={'width': '200px', 'textAlign': 'center'},
style_table={'overflowX': 'auto','overflowY':'auto','maxHeight': '400px','minwidth':'100%','font-family':'Calibri'},
style_header={
'backgroundColor': 'rgb(52,98,145)',
'textAlign':'center',
'color':'white',
'font-family':'Calibri'
}
),
html.Div([
html.Button('Save', id='save-button'),
html.P(id='editable-table-hidden', style={'display':'none'}),
html.P(id='save-button-hidden', style={'display':'none'}),
], className='row')
And the callback is-
@app.callback(Output('save-button-hidden', 'children'),
[Input('save-button', 'n_clicks')])
def clicks(n_clicks):
if n_clicks > 0:
df.to_csv('df.csv', index=False, encoding='utf-8')
How to download the data from the table after using Filter.
I am using the above code but the data that is being downloaded is the df. I want the data that is in the datatable to be downloaded after applying the filter.
How to do the same ? Kinldy help.