Does anyone have any idea on how I can move the standard XGrid
pagination to above the table? Or am I going to have to create my own custom pagination and not use the inbuilt with XGrid
?
There is no public API to put the pagination component on the top, but you can use this CSS trick:
const useStyles = makeStyles({
grid: {
display: "flex",
flexDirection: "column-reverse"
}
});
export default function App() {
const { data } = useDemoData({
dataSet: "Commodity",
rowLength: 100,
maxColumns: 4
});
const classes = useStyles();
return (
<div style={{ height: 400, width: "100%" }}>
<DataGrid
className={classes.grid}
autoHeight
pageSize={5}
rowsPerPageOptions={[5, 10, 20]}
{...data}
/>
</div>
);
}
What I did in my project is I removed the pagination of the DataGrid by adding hideFooterPagination
prop and added a TablePagination component on top of the table.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.