Hello
I am having a problem with the DataTable below. Generally, I have a callback returning data for part of the dataTable. User will fill in the other empty spaces. The second callback will take the part of the user input and do calculation or show on the screen. However, the user input doesn’t get passed in to the second callback. Please help.
html.Div(dash_table.DataTable(
id = ‘DataTable’,
columns = [{‘name’:‘Column1’, ‘id’:‘Column1’}, {‘name’:‘Column2’, ‘id’:‘Column2’}],
editable = True
),
html.Div(id = ‘datatable-test’) #return the user input
)
@app.callback(Output(‘DataTable’, ‘data’),
[Input(‘some_multi_selection_dropdown’,‘value’)])
def DataTable1 (some_dropdown):
return [{‘Column1’ : some_dropdown[i]} for i in range (len(some_dropdown))]
#testing taking the subunit code from user input
@app.callback(Output(‘datatable-test’, ‘children’),
[Input(‘DataTable’,‘data’),
Input(‘DataTable’,‘columns’)])
def test_datatable (rows, columns):
df = pd.DataFrame (rows, columns = [c[‘name’] for c in columns])
code = ‘’
for i in df.index:
code+=str(df[‘Column2’][i])
return html.H4(code)