【问题标题】:react-data-grid 7.0.0 beta.12 ShowCheckbox not working. How to render a checkbox?react-data-grid 7.0.0 beta.12 ShowCheckbox 不工作。如何渲染复选框?
【发布时间】:2022-06-17 18:03:56
【问题描述】:

我试图让 showCheckbox 工作但没有成功。 我设置了这个安装的“react-data-grid”:“^7.0.0-beta.12”, 复选框列根本不会出现。 有人可以帮忙吗?

我在 App.js 中使用的代码

<ReactDataGrid
          columns={this.columns}
          rows={setGlobalMsgList}
          rowsCount={this.props.setGlobalMsgList.length}
          // onRowClick={this.onRowClick}
          onGridSort={this.handleGridSort}
          rowSelection={{
            showCheckbox: true,
            enableShiftSelect: true,
            onRowsSelected: this.onRowsSelected,
            onRowsDeselected: this.onRowsDeselected,
            selectBy: {
              indexes: this.state.selectedIndexes,
            },
          }}
          emptyRowsView={EmptyData}
        />

【问题讨论】:

    标签: reactjs react-data-grid


    【解决方案1】:
    const columns = [
            SelectColumn,
            { key: 'id' , name: "ID", frozen:true }  ]
    

    只需从

    导入 SelectColumn
     import {SelectColumn} from 'react-data-grid'
    

    【讨论】:

      猜你喜欢
      • 2018-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-25
      • 1970-01-01
      • 1970-01-01
      • 2019-04-20
      相关资源
      最近更新 更多