我使用一个dbc.Modal
和一个链接到调用POST请求的回调的Submit按钮在DataTable中创建记录(有8个字段,为了简洁起见,只显示了2个字段):
html.Div([
dbc.Modal([
html.Tr([html.Td('Author(s):', id='country-source-author-label'),
html.Td(dcc.Textarea(id='country-source-author-textarea')
]),
html.Tr([html.Td('Publication Date:',
html.Td(dcc.DatePickerSingle(id='country-source-publication-date-picked')])
], id='add-country-source-modal'),
dbc.Button("Submit", id='add-country-source-submit-button'))
])
以下是此表单生成的示例数据:
county_source_table = ['author_name': 'E.O. Wilson', 'date': '2021-10-31', 'link': '#']
要查看源代码,我有一个DataTable,其中包含指向详细信息列中单个记录的超链接
sources_table = dash_table.DataTable(
id='county-source-table',
columns=[
{'id': 'author_name', 'name': 'Author'},
{'id': 'date', 'name': 'Publication Date'},
{'id': 'link', 'name': 'Details', 'type': 'text', 'presentation': 'markdown'}
],
markdown_options={'link_target': '_self'})
我想做的是单击表中每个记录的链接,打开包含该记录所有相关数据的Dash Bootstrap模式,比如this。我被难住了,有什么想法吗
Plotly社区成员Eduardo和AnnMarieWposted a method to treat DataTable cells as buttons使用表的
active_cell
属性作为回调的输入。这就成功了相关问题 更多 >
编程相关推荐