Hi, I am really hoping someone can help me here, I am at my wits end trying to figure this out. I have a Dash data table where one column needs to have a dropdown.
@app.callback(
[
Output(“panel_beauty_ingredient_match”, “style”),
Output(“tbl_beauty_ingredient_match”, “columns”),
Output(“tbl_beauty_ingredient_match”, “data”),
Output(“tbl_beauty_ingredient_match”, “dropdown_conditional”),
],
[
Input(“btn_beauty_find_alternate”, “n_clicks”),
Input(“txt_beauty_search_terms”, “value”),
Input(“list_beauty_search_by”, “value”),
],
[State(“list_beauty_separators”, “value”), State(“store_beauty_data”, “data”)],
)
def find_nearest_beauty_ingredients(
clicks, search_terms, search_by, separator, store_data
):
if clicks == None:
return [""]if clicks != None: buffer = read_buffer("Beauty_master.csv") master_df = pd.read_csv(buffer) panel_style, columns, data, drops = find_nearest_ingredients( search_terms, master_df, separator ) return panel_style, columns, data, drops
def find_nearest_ingredients(search_terms, master_df, separator):
panel_style = {
“width”: “70%”,
“vertical-align”: “middle”,
}
columns=[
{“id”: “Given”, ‘name’: “Given”},
{“id”: “Nearest”, ‘name’: “Nearest”, “presentation” : “dropdown”},
{“id”: “Certainty”, ‘name’: “Certainty”},
]master_df["Ingredient"] = master_df["Ingredient"].astype(str) master_df = master_df.dropna(subset=["Ingredient"]) master_df["Ingredient"] = master_df["Ingredient"].str.lower() # we use a series for the new fuzz_match_pandas method all_ingredients = master_df[["Ingredient"]] data, drops = faster_fuzz_matching(search_terms, all_ingredients, separator) return panel_style, columns, data, drops
With this code, my table appears correct, except the column that is a dropdown does not display any data.
If I change ALL columns to have “presentation” : “dropdown”, then they ALL do not display data.
columns=[
{“id”: “Given”, ‘name’: “Given”, “presentation” : "dropdown},
{“id”: “Nearest”, ‘name’: “Nearest”, “presentation” : “dropdown”},
{“id”: “Certainty”, ‘name’: “Certainty”, “presentation” : "dropdown},
]
I am confident that the data and dropdowns are working correctly. Once the table is displayed, the user is supposed to click a button that runs calculations on the data in the “Nearest” column. These calculations all work as expected and the results are displayed, so I know the data and dropdowns are correct, they just aren’t showing up. Any suggestions? I am out of ideas. Thanks.
Using:
dash==1.15.0
dash-core-components==1.11.0
dash-html-components==1.1.0
dash-renderer==1.7.0
dash-table==4.10.0
1 post - 1 participant