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 />} 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> );
运行结果 面板展开效果