I am working with React-material-table. I want to add a custom id to each row, which is then going to be utilized for the identifying elements via selenium. I have gone through the internet but wasn't able to get any help.
Here is what I am doing:
<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"
/>
How can I add id to each row?
Try this (docs check under components)
<MaterialTable
components={{
Row: props => <MTableBodyRow id="SOME-ROW-ID-HERE" {...props} />
}}
// other props
/>