【发布时间】:2020-09-08 12:28:22
【问题描述】:
我的应用程序中有一个带有 Dash 的表格,但我使用 html 组件而不是 Dash 的 DataTable 来制作它。该应用程序很大并且已经配置,所以我想避免重写它。在 html 中有 <table class="sortable"> 使表格可排序。但是,当我用破折号构造表时,我应该在哪里写这个属性?这是我的表格代码:
def generate_table(dataframe, max_rows=1000):
return html.Table([
html.Thead(
html.Tr([html.Th(col) for col in dataframe.columns])
),
html.Tbody([
html.Tr([
html.Td(dataframe.iloc[i][col]) for col in dataframe.columns
]) for i in range(min(len(dataframe), max_rows))
])
], style={
'margin-right': 'auto',
'margin-left': 'auto'
}
)
【问题讨论】:
标签: python plotly-dash