-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DataGrid] server side pagination not working #568
Comments
It was broken in #412. |
Here is a failing test case that we would need to add to avoid regressions: describe('pagination', () => {
it('should support server side pagination', () => {
const ServerPaginationGrid = () => {
const [page, setPage] = React.useState(1);
const [rows, setRows] = React.useState<typeof defaultProps['rows']>([]);
const handlePageChange = (params) => {
setPage(params.page);
};
React.useEffect(() => {
let active = true;
(async () => {
const newRows = [
{
id: page,
brand: `Nike ${page}`,
},
];
if (!active) {
return;
}
setRows(newRows);
})();
return () => {
active = false;
};
}, [page]);
return (
<div style={{ height: 300, width: 300 }}>
<DataGrid
{...defaultProps}
rows={rows}
pagination
pageSize={1}
rowCount={3}
paginationMode="server"
onPageChange={handlePageChange}
/>
</div>
);
};
render(<ServerPaginationGrid />);
expect(getColumnValues()).to.deep.equal(['Nike 1']);
fireEvent.click(screen.getByRole('button', { name: /next page/i }));
expect(getColumnValues()).to.deep.equal(['Nike 2']);
});
}); |
Hi Olivier, Firstly, thanks to you and the maintainers for this wonderful library. I'm also having this issue. Is there a way to override the functionality temporarily as a workaround? I made a new component using DataGrid, but had to rework using MaterialTable because of the server-side pagination issue. I'm not able to get what I want using MaterialTable because I want to be able to search certain fields from a separate form, but I can't use a function for a remote data source AND data that is otherwise saved in the state via custom fetch function. No bueno. Thanks for any guidance you're able to offer. Edit: DUH, my temporary solution is |
@janderson215 Which issue did you face?
Maybe we should move the component under the lab navigation in the documentation? cc @dtassone, @mbrookes |
Don't want to take this issue off-topic, but here's a description: I feel my language is not clear, so here are the steps I follow and the outcome of these steps:
|
@janderson215 Ok thanks |
Installing |
Did you stop running your web app and do another yarn/npm start? I’ve found that I need to do that pretty often after changes in the dependencies. It seems like it should not be the case, but I know that it is for my setup.
… On Nov 18, 2020, at 7:47 AM, samrudh ***@***.***> wrote:
Installing @***@***.*** did not resolve the server side pagination for me. Is there any work around?.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Hey @janderson215 I did try those steps, along with clearing cache and removing and installing node modules again - but it did not work. I will use a different table library. Thanks. |
Since this is a paid product ... wanted to check if there is an ETA on this fix? ... Being able to load the second page is going to be a pretty obvious step for all users |
@visheshd Mind that the feature is part of the MIT |
I am new to material-ui and react altogether and lost 2 hours already thinking I was doing something wrong. |
Yes |
* fix #568 and other small issues * added test * fix dep array * prettier * Apply suggestions from code review Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com> * remove toggle on options Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
* fix #568 and other small issues * added test * fix dep array * prettier * fix apply filter on rows update * fix filters on rendering new rows
Current Behavior 😯
Second page not loading
Expected Behavior 🤔
Pagination should work correct
Steps to Reproduce 🕹
https://material-ui.com/components/data-grid/pagination/#server-side-pagination
Steps:
The text was updated successfully, but these errors were encountered: