-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
UI-Grid minRowsToShow not show in refresh() #2531
Comments
This sounds like another flavour of #1819. What would you expect the grid to do when you changed minRowsToShow? |
I think that when minRowsToShow changes that it should refresh the grid to reflect the new minRowsToShow. Refresh might not be the right word as currently if you change the minRowsToShow you have to fully reload the page to reflect the change. It may just have to do with how the core.refresh() reads the gridOptions, but it would be great if that was reflected on the refresh. |
I would also like this feature. minRowsToShow seems to be misnamed, as it's not a minimum, it's just the number of rows the grid auto-sizes itself to show, so rowsToShow would be more accurate. However, the ideal number of rows to show isn't always known at startup, and may change over time. For example, if I'm using the grid to show the results of a web service call, then the number of rows will depend on the data I get back. If I only have a single entity to show, then rowsToShow would be one. If I have a thousand, then I might want to set it to ten or twenty. As it stands, I have copied the auto-sizing logic from the grid into a custom directive, that watches minRowsToShow and does the auto-size every time it changes. This works, but it would be nice if the grid itself supported this behaviour, or at least exposed the auto-sizing ability in a way that I could call, rather than having to copy the code into my own directive. |
I agree, I would also like this behavior. I think that minRowsToShow should default to 1, and there could be a rowsToShow setting that you could set for the desired page size (10 or 20 for example). If the length of the data bound to the grid is less than rowsToShow, minRowsToShow should be set to the length of the data array. On another note, I also think that the scroll bar settings (horizontal and vertical) and the menu settings (both grid and column level) should default to off. |
@jonrimmer Would you mind posting that custom directive? Would save me a few minutes of digging. :) Resizing the grid seems to be my next best option instead of forcing the scrollbars to be always on. |
@kcaron-cst No problem, here you go: https://gist.github.com/JonRimmer/d9c9091a9c300286a8ef |
@jonrimmer Awesome, thanks so much. Worked great for me with a couple edits to account for |
Sounds like another flavour of #3031, tying them all together so if anyone works on it they can find them all. |
I would also like this feature. I ended up doing a pretty hackish work-around by finding the elements that needed their height be expanded to fit the new rows, and then multiplying the number of rows by the height of the row and then setting the height of the elements to the total. It looks something like this: heightValue = numberOfRows * heightOfRow + 'px'; this is called each time the number of rows changes and thus the height of the grid is always updated dynamically... Good luck |
If minRowsToShow works when rendering the grid, it would be really nice to be able to update that number when changing data so the height of the grid can change. Is this something you guys would consider putting in if PRs were submitted? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had recent activity. If you believe that this is still an issue in the latest version, feel free to re-open it. Thank you for your contributions. |
After changing the minRowsToShow in gridOptions and running a gridApi.core.refresh(), the grid still keeps to the old value even though a console.log() shows that the gridOptions.minRowsToShow has changed.
The text was updated successfully, but these errors were encountered: