【问题标题】:Is there a way to return the current page in a dashTable?有没有办法在 dashTable 中返回当前页面?
【发布时间】: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


    【解决方案1】:

    我认为this is what you need。文档介绍了如何在后端处理分页。它不仅可以通过仅加载您需要的内容来帮助您在浏览器中加快处理速度,而且您可以获取 page_current 属性作为回调的输入。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多