I want to use Buttons in a dash datatable. I read it is not yet supported but dropdown is. So i want to do something like:
self.dataFrame['Start/Stop'] = pd.Series(self.dataFrame.index).apply(lambda x: dcc.Dropdown(options=[{'label':'Stop','value':'Stop'}],label='Stop',id="Start_"+str(x),className="ml-auto"))
dt.DataTable(
data=self.dataFrame.to_dict("records"),
columns = [{"name": key,
"id": key,
"type":value,"format":Format(precision=2)} for key,value in self.dataFrame.columns],
#fixed_columns={'headers': True,'data': 1},
fixed_rows={'headers': True, 'data': 0},
#fixed_columns={'headers': True,'data': 1},#'headers': True,
filter_action='native',
filter_query='',
id=pre + 'dataTable',
sort_action='native',
sort_mode='multi',
#sort_by=[],#'startTime'
style_table={
'overflowX': 'scroll',
#'overflowY': 'scroll',
'maxHeight': '800px',
},
style_data_conditional=[{
"if": {'filter_query': '{status} eq SUCCESS'},
"backgroundColor": "#3D9970",
'color': 'white'
},{
"if": {'filter_query': '{status} eq FAILURE'},
"backgroundColor": "#ff0000",
'color': 'white'}
],
style_as_list_view=True,
style_header={'backgroundColor': 'rgb(100, 100, 100)',
'color': 'white'},
style_cell={
'backgroundColor': 'rgb(250, 250, 250)',
'color': 'black',
'font_size': '12px',
#'minWidth': '0px',
#'maxWidth': '360px',
'width':'180px',
'whiteSpace': 'no-wrap',
'overflow': 'hidden',
'textOverflow': 'ellipsis'
}
)])
And then converting dataframe to dict and give it to the column argument of the datatable. Every dropdown in each cell of the Start/stop column should trigger a start/stop signal for a specific running process of that table row.
Is something like this possible?