Hi everyone,
(edit: Just wanted to clarify that I am just looking for an explanation to what the error means to debug my code, not for a solution )
I have been getting a weird error that I seem to be unable to replicate to publish a minimum viable code here, thus I am looking for a general understanding of what that means. When sending back a df.to_dict(ārecordsā),
with back-end paging in python, if I add the options for multi selection (row_selectable=āmultiā and selected_row=), I get the following error (edit: when I donāt add multi selection the table works):
āo.weights[e] is undefinedā
What does that error mean? Cannot find anything online
I am doing the following in the code
className=ānine columns chart_divā,
children=[
dt.DataTable(
id=āapg_ppg_tableā,
columns=,#[{ānameā: i, āidā: i} for i in df.columns],
data=pd.DataFrame().to_dict(ārecordsā),row_selectable="multi", selected_rows=[], #action on table page_current=0, page_size=PAGE_SIZE, page_action='custom', filter_action='custom', filter_query='', sort_action='custom', sort_mode='multi', sort_by=[], ) ],
@app.callback([Output(component_id=āapg_ppg_tableā, component_property=ādataā),Output(component_id=āapg_ppg_tableā, component_property=ācolumnsā)]
,[Input(ābutton_filteringā, ān_clicksā),Input(āadditional_columns_tableā, āvalueā),Input(āapg_ppg_tableā, āpage_currentā), Input(āapg_ppg_tableā, āpage_sizeā),Input(āapg_ppg_tableā, āsort_byā),Input(āapg_ppg_tableā, āfilter_queryā)],)def update_table(n_clicks,name_cols_to_show,page_current,page_size,sort_by,query):
df = find_in_table(df,query.split(ā && '))
df = sort_table(df,sort_by)
page_current = min(page_current,max(round(len(df)/page_size)-1,0))
df = df.loc[page_current*page_size:(page_current+ 1)*page_size,cols_to_show].reset_index(drop=True) #this reset index should be useless rn
cols_to_show.remove(āHIGHLIGHTā)
data_table_columns = [columns_type_dict[i] for i in df[cols_to_show].columns]
print(df)
return [df.to_dict(ārecordsā),data_table_columns]
Where sort_table and find_in_table are taken from the datatable walkthrough (find_in_table == filtering action, just in a separate function)