0

我有要求在单击详细列表行时打开模式。我们正在使用办公室 ui 面料。

4

1 回答 1

0

这是详细列表

<DetailsList
              items={todos}
              columns={column}
              className={styles.detailList}
              compact={true}
              />

使用 state 添加列并打开对话框 onRender

const [column, setColumn] = useState<IColumn[]>([
    { key: 'column1', name: 'Title', fieldName: 'Title', minWidth: 100, maxWidth: 200, isResizable: false },
    { key: 'column2', name: 'Description', fieldName: 'description', minWidth: 100, maxWidth: 200, isResizable: false },
    { key: 'column4', name: 'Edit', fieldName: 'edit', minWidth: 100, maxWidth: 100, isResizable: false,
        onRender: (item) => (
           <Link onClick={() => toggleHideDialog()}>Edit</Link>
        ),
      },
    { key: 'column5', name: 'Delete', fieldName: 'delete', minWidth: 100, maxWidth: 100, isResizable: false,
        onRender: (item) => (
           <Link onClick={() => { console.log('clicked', item); }}>Delete</Link>
        ),
      },
  ])
于 2022-01-24T19:28:10.787 回答