1
the error that presents me: Error: Material-UI: The data grid Component requires all Rows to have a Unique id Property. A Row was provided without id in the Rows prop: {} I build my table according to the data I get from an API. Here is my table:
for(var i = 0; response.data.length > i ; i++)
{
field = Object.keys(response.data[i])
headerName = Object.keys(response.data[i])
}
for(var i = 0; field.length > i; i++)
{
colunas.push({field:field[i],headerName:headerName[i],width:150})
}
for (var i = 0; response.data.length > i; i++){
linha.push(response.data[i])
}
example of column return:
{field: "IdChamada", headerName: "IdChamada", widht: 150}
{field: "Campanha", headerName: "Campanha", widht: 150}
{field: "Tabulacao", headerName: "Tabulacao", widht: 150}
example of line return:
{IdChamada: 5035737, Campanha: Empresa_Update, Tabulacao: Concluido}
My Datagrid:
<div style={{ height: 400, width: '100%' }}>
<DataGrid
rows={rows}
columns={columns}
pageSize={10}
checkboxSelection
id = "IdChamada"/>
</div>
It worked, thank you very much :)
– Igor
it was a pleasure :)
– Leo Brescia