Hello!
I have a datatable with 4 dropdown options. One of the them ‘Units Type Code’ should be based on the option chosen for ‘Product Name’, i.e. if they choose ‘chemical 1’, ‘Units Type Code’ would have specific options based upon that Product.
I have seen examples of dynamic dropdowns where the dropdowns are separated, but since my dropdowns are in the same datatable, I’m confused about how this might work.
My code is quite long, so for convenience I have just included the specific datatable in question.
The dropdowns options right now are in lists, but I do have a dictionary with products as keys and lists of units as values, which I think could be helpful in this scenario.
html.Div(children=[
dash_table.DataTable(id={'type': 'process-table',
'index': n_clicks},
data=[{}],
style_table={'margin': '2em',
'width': '90%',
'display': 'inline-block'},
style_cell={'font-family': 'calibri',
'textAlign': 'left'},
columns=[{'id': 'Function Type Code',
'name': 'Function Type Code',
'presentation': 'dropdown'},
{'id': 'Direction Type Code',
'name': 'Direction Type Code',
'presentation': 'dropdown'},
{'id': 'Product Name',
'name': 'Product Name',
'presentation': 'dropdown'},
{'id': 'Conversion Factor',
'name': 'Conversion Factor',
'clearable': True, 'type': 'numeric'},
{'id': 'Units Type Code',
'name': 'Units Type Code',
'presentation': 'dropdown'},
],
row_deletable=True,
editable=True,
dropdown={'Function Type Code': {'options': [{'label': i, 'value': i} for i in
function_list]},
'Direction Type Code': {'options': [{'label': i, 'value': i} for i in
['Input', 'Output']]},
'Product Name': {'options': [{'label': i, 'value': i} for i in
product_list]},
'Units Type Code': {'options': [{'label': i, 'value': i} for i in
units_list]},
})
Any help appreciated!