-
Notifications
You must be signed in to change notification settings - Fork 72
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
[Data Grid] Fix logic when pageSize larger than number of rows #726
[Data Grid] Fix logic when pageSize larger than number of rows #726
Conversation
Signed-off-by: Sirazh Gabdullin <[email protected]>
@curq I dont think you should limit the options in datagrid to fix this issue, but rather treat the row limit more like Look at the behavior of the list here and how this behaves as an example: https://playground.opensearch.org/app/management/opensearch-dashboards/objects |
Signed-off-by: Sirazh Gabdullin <[email protected]>
Signed-off-by: Sirazh Gabdullin <[email protected]>
@ashwin-pc Thank for the feedback, I have changed my fix, so that row limit behave like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and elegant fix. Pulled this down and works as expected. I did notice that when you have say 51 rows and you select see 50 rows at a time, switching to the next page keeps the row height still at 50 even though there is just a single row. But Im pretty sure that we want it that way since I prefer avoiding a layout repaint given that the primary goal of the DataGrid is to improve rendering large volumes of data, and a layout repaint can be slow and expensive for such re-renders.
* Fix logic when pageSize larger than number of rows Signed-off-by: Sirazh Gabdullin <[email protected]> * Remove incorrect fix Signed-off-by: Sirazh Gabdullin <[email protected]> * Fix logic when pageSize larger than number of rows Signed-off-by: Sirazh Gabdullin <[email protected]> --------- Signed-off-by: Sirazh Gabdullin <[email protected]> (cherry picked from commit f65b5ca) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…#825) * Fix logic when pageSize larger than number of rows * Remove incorrect fix * Fix logic when pageSize larger than number of rows --------- (cherry picked from commit f65b5ca) Signed-off-by: Sirazh Gabdullin <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
There is a bug with DataGrid component, when there is less number of rows with data than number of rows per page, the DataGrid component is rendered with height equal to number of rows per page, instead of number of actual rows. This results in an empty unused space.
For example, when there is 99 rows but the number of rows is 120, the table is rendered with height that fits 120 rows, and not 99. Screenshot:
The issue is even more evident when we make number of rows per page even larger (e.g. 1000 per page). I explained more in the issue #699 where I provided a sandbox.
After fix:
You might notice that the rows per page is 99 in the screenshot (actual number of rows), but the options show 120 ( they usually are provided by the developer), so I'm not sure if this okay.
Issues Resolved
Fixes #699
Check List
yarn lint
yarn test-unit
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.