How to remove "No results found" label from the list when DataGrid has empty component

Viewed 214
const TabbedDatagrid = (props: TabbedDatagridProps) => (
    <Datagrid empty={<Empty />}>
        <TextField source="id" />
        <TextField source="createDate" />
        </Datagrid>
);

const Empty = () => {
    const { basePath } = useListContext();
    return (
        <Box textAlign="center" m={1}>
            <Typography variant="h4" paragraph>
                No products available
            </Typography>
            <Typography variant="body1">
                Create one or import from a file
            </Typography>
            <CreateButton basePath={basePath} />
            <Button>Import</Button>
        </Box>
    );
};    

const MyList = (props: ListProps) => (
    <List
        {...props}
        sort={{ field: 'createDate', order: 'DESC' }}
        perPage={10}
        filters={orderFilters}
        pagination={<PostPagination />}
    >
        <TabbedDatagrid />
    </List>
);

In the result both are displayed, 'No results found" and Empty component How to display only Empty component?

enter image description here

2 Answers

The <Pagination> component takes a limit prop.

From the React-Admin docs

limit: An element that is displayed if there is no data to show (default: <PaginationLimit>)

You could try passing null <PostPagination limit={null} /> to hide that default "No results found" message.

Related