Reputation: 97
I am testing the DataTable component of PrimeReact. Just testing because I can't yet decide which component library to use.
I'm using editMode="cell" and the onCellEditComplete callback of DataTable when modifying a field and with the rowData prop I modify another field (another cell). It seems to modify it but when editing that cell the input text doesn't update properly.
Example:
const onCellEditComplete = (e) => {
let { rowData, newValue, value, field } = e;
if (field=="code") { //code is the modified field/cell
rowData["code2"]="pref"+rowData["code"]; //an expression
//'code2' is the other field to update based en 'code'
}
// ...
}
When trying to edit the cell of 'code2' field, the input doesn't update. It shows the previous value.
Upvotes: 0
Views: 2106
Reputation: 324
Your rowData should look like this: rowData.code2="pref"+rowData.code
Upvotes: 0