【发布时间】:2020-03-27 12:37:54
【问题描述】:
我有一个包含不同页面 (pagination = True) 的仪表板,因为它有超过 5000 条记录,并且当我使用 page_size=5000 时页面加载非常缓慢。我创建了一个 def,当单击我正在使用的 sqlite 数据库中的更多详细信息时,它会返回该行的内容。
这是基本代码:
@app.callback(
Output('popup-container', 'children'),
[Input('table', 'selected_cells'),
Input('table', 'derived_virtual_data'),
Input('my-dropdown', 'value'),
],
)
def update_popup(sel, current_table, value):
if sel:
column_name = sel[0]['column_id']
row_num = sel[0]['row']
valor = current_table[row_num][column_name]
print(valor)
print(current_table)
“popup-container”是一个 Div,“table”是 dashTable,“my-dropdown”是一个不干扰的下拉菜单。 Sel 是获取 selected_cell 行的变量。
这个 def 对 dashtable 的第一页工作正常。但是,当我更改页面时, current_table 变量仅返回表的第一页。如何让 current_table 返回当前页面数据?
【问题讨论】:
标签: python html css plotly-dash