Tree View with Sorting
Hello,
Thanks for the wonderful react-data-grid component.
I'm trying to get the react-data-grid component to have the tree view function with sort functionality. However, after expanding a grouped row, an exception is thrown as you can see from the codesandbox fork here : https://codesandbox.io/s/rdg-tree-view-yu4zs?file=/src/index.js
The example is based on the basic tree and sort functionality examples of react-data-grid (https://adazzle.github.io/react-data-grid/docs/examples/simple-grid)
Requesting help or an example on how to enable sorting on the tree view.
Thank You.
The error is as below.
eval
/src/index.js:100:24
97 | };
98 | const onCellExpand = args => ({ rows, expandedRows }) => {
99 | const rowKey = args.rowData.id;
> 100 | const rowIndex = rows.indexOf(args.rowData);
| ^
101 | const subRows = args.expandArgs.children;
102 | if (expandedRows && !expandedRows[rowKey]) {
103 | expandedRows[rowKey] = true;
You have the error, because setState hook doesn't know anything about "rows". Only in the "setRows" hook you know about rows.
Closing this as we do not support previous versions of react-data-grid anymore.
Please try the latest version, currently 7.0.0-beta.2.
If you still run into issues with the latest version, please open a new issue.