如何将 ID 添加到 material table 行?

How to add ids to material table rows?

我正在与 React-material-table 合作。我想为每一行添加一个自定义 id,然后通过 selenium 将其用于识别元素。我浏览了互联网,但无法获得任何帮助。

这是我正在做的事情:

 <MaterialTable
          columns={[
            { title: 'Adı', field: 'name' },
            { title: 'Soyadı', field: 'surname' },
            { title: 'Doğum Yılı', field: 'birthYear', type: 'numeric' },
            { title: 'Doğum Yeri', field: 'birthCity', lookup: { 34: 'İstanbul', 63: 'Şanlıurfa' } }
          ]}
          data={[{ name: 'Mehmet', surname: 'Baran', birthYear: 1987, birthCity: 63 }]}
          title="Demo Title"
        />

如何为每一行添加 id?

试试这个(docs 检查组件)

<MaterialTable        
    components={{
        Row: props => <MTableBodyRow id="SOME-ROW-ID-HERE" {...props} />
    }}

  // other props

/>