import { CreateButton, Datagrid, FilterButton, FilterForm, ListBase, Pagination, TextField, TextInput, BooleanField } from 'react-admin'; import { Stack } from '@mui/material'; const postFilters = [ <TextInput label="Search" source="id" alwaysOn />, <TextInput label="name" source="name" defaultValue="Hello, World!" />, ]; const ListToolbar = () => ( <Stack direction="row" justifyContent="space-between"> <FilterForm disableSaveQuery filters={postFilters} /> <div> <FilterButton filters={postFilters} /> <CreateButton /> </div> </Stack> ) export const FilterButtonList = () => ( <ListBase resource="t_geyao_person"> <ListToolbar /> <Datagrid> <TextField source='id'></TextField> <TextField source='name'></TextField> <TextField source='sex'></TextField> <TextField source='salary'></TextField> <BooleanField source='status'></BooleanField> </Datagrid> <Pagination /> </ListBase> )
运行结果