I am new to ReactJS and I am trying to work with React Data Grid. When I filter my table, make a change to a cell, then unfilter the table, the change reverts back to its previous value. If I change const rows = this.state.rows.slice(0); to const rows = Selectors.getRows(this.state); my changes stay, but then I can not unfilter the table.
Here is how I am handling Grid Rows to Update:
handleGridRowsUpdated = ({ fromRow, toRow, updated }) => {
const rows = this.state.rows.slice(0);
// const rows = Selectors.getRows(this.state);
for (let i = fromRow; i <= toRow; i++) {
const rowToUpdate = rows[i];
const updatedRow = update(rowToUpdate, { $merge: updated });
rows[i] = updatedRow;
if (!rows[i].Date) {
const index = this.state.counter;
newRows[index] = rows[i];
this.handleUpdate(rows[i]);
this.setState({ newRows });
} else {
updatedRows[rows[i].Date] = rows[i];
this.handleUpdate(rows[i]);
this.setState({ updatedRows });
}
}
this.setState({ originalRows: rows });
};
I have looked at the RDG docs and examples. In their filter example, they don't allow you to edit cells.
Thanks in advance!