Skip to content

Commit 0947b7c

Browse files
committed
Document limits of Datagrid to DataTable codemod.
1 parent 5a4b869 commit 0947b7c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/DataTable.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,3 +1871,18 @@ npx jscodeshift ./path/to/src/ \
18711871
--parser=tsx \
18721872
--transform=./node_modules/ra-core/codemods/replace-Datagrid-DataTable.ts
18731873
```
1874+
1875+
Here is what the codemod will transform for you:
1876+
1877+
- Replace `<Datagrid>` with `<DataTable>`.
1878+
- Replace `rowStyle` with `rowSx`.
1879+
- Rename the keys in `sx` prop from `"& .RaDatagrid-xxxx"` to `"& .RaDataTable-xxxx"`.
1880+
- Replace simple `<TextField>` with `<DataTable.Col>`.
1881+
- Replace simple `<NumberField>` with `<DataTable.NumberCol>`.
1882+
- Wrap all other fields in `<DataTable.Col>`, keeping `source` and `label` properties in `<DataTable.Col>`.
1883+
- Replace `Datagrid` imports by `DataTable`, and remove unused `TextField` and `NumberField` imports if they are now all replaced.
1884+
1885+
However, the codemod will **not**:
1886+
1887+
- Replace `<DatagridConfigurable>`.
1888+
- Replace `<Datagrid>` from `@react-admin/ra-rbac` (and all its children). Refer to [Access Control section](#access-control) to use `<DataTable>` with `<CanAccess>`.

0 commit comments

Comments
 (0)