我是歌谣 放弃很容易 但是坚持一定很酷 微信公众号关注前端小歌谣学习前端知识
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的可以多选