Replies: 3 comments 3 replies
-
Something like that, also see the README file. ...
import { useState } from "react";
import { textEditor } from 'react-data-grid';
....
const initialRows = [...] // all your rows
const [rows, setRows] = useState(initialRows);
const columns = [
{ key: 'id', name: 'ID' }, // relate to rowKeyGetter
{ key: 'name_of_my_field', name: 'My editable field', editor: textEditor},
.......
];
});
const rowChange = (new_rows, changes) => {
console.log('new_rows: ', new_rows);
console.log('changes: ', changes);
setRows(...rows, new_rows);
};
const function rowKeyGetter = (row: Row) => {
return row.id; // important: set with your unique ID
};
<DataGrid
columns={columns}
rows={rows}
onRowsChange={rowChange}
rowKeyGetter={rowKeyGetter}
/> |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks, but my question is not about cell editing, it is about how to refresh a cell after its data model has been updated, For example, a cell displays a price, and the underlying price value has changed => How to refresh the UI ? Actually I found the answer. Let me know if you'd like me to post it. |
Beta Was this translation helpful? Give feedback.
3 replies
-
Looking for the same feature in my app, please post your answer here |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello
How can I update a given cell programmatically please ?
For example, with the grid in the Quick Start section, how can I set title of row 1 to be Hello (instead of Demo) ?
I didn't find an answer to this simple question in the readme...
Beta Was this translation helpful? Give feedback.
All reactions