display_cols=["col1","col2","col3","col4"]
columns_property=[{"name": i, "id": i, "deletable": False, "selectable": True, "renamable":True, "hideable":True} for i in display_cols]
dash_table.DataTable(id="table",
columns=columns_property,data=[],fill_width=True,
export_columns="all",export_format="xlsx", sort_action="native",is_focused=True,
sort_mode="multi",export_headers ="names",editable=True,tooltip_data=tooltip,## Tootlip is returned from callback as options
style_cell={'textAlign': 'left','border': '1px solid grey',
'whiteSpace':'normal','height':'auto'},
style_header={'backgroundColor': 'white','fontWeight': 'bold',
'border': '1px solid black'},
style_table={'fontFamily': 'Open Sans',
'textAlign': 'right',
'whiteSpace': 'no-wrap',
'overflowX': 'scroll',
'minWidth': '100%',
'height': '600px',
'overflowY': 'scroll'})
@app.callback([Output('table', 'data'),Output("tooltip", "options") ],
[Input('submit3', 'n_clicks')],
[
State('input1', 'value'),
State('input2', 'value')
]
)
def update_output(clicked, input1, input2):
if clicked:
input_file=input1
model_path=input2
""" Some Code for Generatng DF"""
df=df[["col1","col2","col3","col4"]]
tooltip_data= [{c:{'type': 'text', 'value': f'{r},{c}'} for c in df.columns} for r in df[df.columns].values]
return list(df.to_dict("index").values()), tooltip_data
@chriddyp I am using this code, but not sure whether it is correct or not. If you can provide an example that would be great.