禁用突出显示 DashTable 中的活动单元格

Disable highlighting of active cell in DashTable

如何停止在破折号数据表中突出显示活动单元格(最后单击的单元格)?

这可以通过在创建数据时使用条件样式选择单元格时继承背景颜色和边框来实现table:

style_data_conditional=[
    {
        "if": {"state": "selected"},
        "backgroundColor": "inherit !important",
        "border": "inherit !important",
    }
]

或者,您应该可以通过将自定义 CSS 文件添加到项目的资产文件夹中来实现此目的。 the Dash forum.

中解释了如何执行此操作

我已通过将值设置为透明来完全删除突出显示。

.dash-spreadsheet-container .dash-spreadsheet-inner table {
        border-collapse: collapse;
        font-family: monospace;
        --accent: transparent  !important;
        --border: transparent !important;
        --text-color: transparent !important;
        --hover: transparent !important;
        --background-color-ellipses: transparent !important;
        --faded-text: transparent !important;
        --faded-text-header: transparent !important;
        --selected-background: transparent !important;
        --faded-dropdown: transparent !important;
        --muted: transparent !important;
    }

我花了一段时间,none 我在网上找到的解决方案有效。

可以通过将 .css 文件(即 datatable.css 放入资产文件夹来设置 'hotpink' 选择的样式。

我的文件内容是:

td.dash-cell.cell--selected.focused {
  background-color: #c4f0d5 !important;
}

td.dash-cell {
  border-color: #d8d8d8 !important;
}

第一种样式用于 highlighted/focused 单元格,第二种样式用于设置 table 中所有单元格的样式,这里是边框颜色。