简体   繁体   English

如何使 select 所有复选框在 office-ui-fabric-react 详细信息列表中始终可见

[英]How to make select all checkbox always visible in office-ui-fabric-react DetailsList

I am using the DetailsList component of office-ui-fabric-react to display my table.我正在使用 office-ui-fabric-react 的 DetailsList 组件来显示我的表格。 I am setting the prop我正在设置道具

checkboxVisibility={CheckboxVisibility.always}

to make the checkboxes visible always.使复选框始终可见。 But this is not working for the select all checkbox which is in the header.但这不适用于 header 中的 select all 复选框。 Select All checkbox is visible only when I hover over it. Select 所有复选框仅在我通过 hover 时才可见。 I want the select all checkbox to be visible always.我希望 select all 复选框始终可见。 Any solution for this?有什么解决办法吗?

<DetailsList
    columns={this.columns}
    selectionMode={SelectionMode.single}
    ariaLabelForSelectAllCheckbox={'Select All'}
    items={this.items}
    checkboxVisibility={CheckboxVisibility.always}
    onRenderRow={this.renderRow}
    onRenderHeader={this.renderHeader}
/>

You also have to import the checkbox visibility:您还必须导入复选框可见性:

import { CheckboxVisibility } from 'office-ui-fabric-react';

Can you share the code by creating example on codepen or stackblitz or any other online editor.您能否通过在 codepen 或 stackblitz 或任何其他在线编辑器上创建示例来共享代码。

Remove the selectionMode={SelectionMode.single} prop and see the output.移除selectionMode={SelectionMode.single}属性并查看 output。 The all checkbox will be visible always including the one which is in header. all 复选框将始终可见,包括 header 中的复选框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM