import React from "react"; import { List, Datagrid, TextField, EditButton,BooleanField } from 'react-admin'; import { useRecordContext } from "react-admin"; const PostPanel = () => { const record = useRecordContext(); return ( <div dangerouslySetInnerHTML={{ __html: record.name }} /> ); }; export const DatagridIsRowList = () => ( <List resource="t_geyao_person"> <Datagrid expand={<PostPanel />} isRowSelectable={ record => record.id > 2 } isRowExpandable={row => row.id} > <TextField source="id" /> <TextField source='name'></TextField> <TextField source='sex'></TextField> <TextField source='salary'></TextField> <BooleanField source='status'></BooleanField> <EditButton /> </Datagrid> </List> );
运行结果 超过2的可以多选