0

我正在尝试使用 onRowClick 从选定行中获取数据并在弹出对话框输入字段中显示该数据,但不幸的是它不适用于 selectableRowsOnClick=true 和 selectableRows:"multiple"。

任何帮助将非常感激。

到目前为止,这是我的代码:

const options = {
    rowHove: true,
    filter: true,
    selectableRows: "multiple",
    selectableRowsOnClick: false,
    filterType: "checkbox",
    responsive: "standard",
    rowsPerPage: 10,
    expandableRows: true,
    //drag columns
    draggableColumns: {
      enabled: true,
      transitionTime,
    },
    onRowsSelect: (rowsSelected, allRows) => {
      const dataToState = allRows.map((item) => {
        return item;
      });
      mySelectedRows = dataToState;
      console.log(mySelectedRows);

      console.log(allRows);
    },

    onRowSelectionChange: (
      currentRowsSelected,
      allRowsSelected,
      rowsSelected
    ) => {
      const dataToState = rowsSelected.map((item) => {
        return item;
      });
      mySelectedRows = dataToState;
      console.log(mySelectedRows);

      console.log(currentRowsSelected);
      console.log(allRowsSelected);
      console.log(rowsSelected);
    },

    onCellClick: (cellIndex, rowIndex) => {
      console.log(cellIndex, rowIndex);
      console.log(cellIndex);
      console.log(rowIndex);
    },

    onRowClick: (rowData, rowMeta) => {
      console.log(rowData);
      console.log(rowMeta[mySelectedRows]);
    },

这是弹出组件

<Popup
  title="Enter Cage No."
  openPopup={openPopup}
  setOpenPopup={setOpenPopup}
>
  <Input placeholder="Enter Cage No." value={mySelectedRows}></Input>
  <SubmitButton> Submit </SubmitButton>
</Popup>
4

0 回答 0