如何在破折号数据表的列字段中添加超链接
How to add hyperlink in column field of dash Datatable
我想将 Hyperlink 添加到第一列 CR-number,所以它应该是可点击的,点击它会重定向到 link。
下面是它的代码片段。
html.Div(
className = "row",
children = [
dash_table.DataTable(
id='datatable-cr-list',
columns=[
{"name": i, "id": i} for i in cr_columns_to_display
],
filter_action = "native",
sort_action = "native",
style_cell_conditional=[
{'if': {'column_id': 'Title'},
'textAlign': 'left',
'overflow': 'hidden',
'textOverflow': 'ellipsis',
'width': '60%',
'whiteSpace': 'normal'
}
],
style_data_conditional=[
{
'if': {'row_index': 'odd'},
'backgroundColor': 'rgb(230, 242, 255)'
}
],
style_header={
'backgroundColor': 'rgb(153, 204, 255)',
'fontWeight': 'bold'
},
export_format="csv",
)
]
),
这里是 table 的图像,我想在第一列中添加一个 hyperlink。我们有什么功能可以在短划线中添加 hyperlink 吗?
我修复了使用以下方法将超链接添加到第一列的问题,并在 Table 字段的布局中添加“演示文稿”:'markdown'
def f(row):
return "[{0}](<link of redirection>{0})".format(row["CR_Number"])
if open_cr_count > 0:
df_fa_direct_open["CR_Number"] = df_fa_direct_open.apply(f, axis=1)
我想将 Hyperlink 添加到第一列 CR-number,所以它应该是可点击的,点击它会重定向到 link。
下面是它的代码片段。
html.Div(
className = "row",
children = [
dash_table.DataTable(
id='datatable-cr-list',
columns=[
{"name": i, "id": i} for i in cr_columns_to_display
],
filter_action = "native",
sort_action = "native",
style_cell_conditional=[
{'if': {'column_id': 'Title'},
'textAlign': 'left',
'overflow': 'hidden',
'textOverflow': 'ellipsis',
'width': '60%',
'whiteSpace': 'normal'
}
],
style_data_conditional=[
{
'if': {'row_index': 'odd'},
'backgroundColor': 'rgb(230, 242, 255)'
}
],
style_header={
'backgroundColor': 'rgb(153, 204, 255)',
'fontWeight': 'bold'
},
export_format="csv",
)
]
),
这里是 table 的图像,我想在第一列中添加一个 hyperlink。我们有什么功能可以在短划线中添加 hyperlink 吗?
我修复了使用以下方法将超链接添加到第一列的问题,并在 Table 字段的布局中添加“演示文稿”:'markdown'
def f(row):
return "[{0}](<link of redirection>{0})".format(row["CR_Number"])
if open_cr_count > 0:
df_fa_direct_open["CR_Number"] = df_fa_direct_open.apply(f, axis=1)