-
-
Notifications
You must be signed in to change notification settings - Fork 844
Fix auto-sizing of ui.aggrid
#5277
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
base: main
Are you sure you want to change the base?
Conversation
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.
I can easily take this as a hotfix, as this code really fixes the non-display of AG Grid, and there's no valid use case of auto_size_columns
and flex
at the same time as of current NiceGUI version because it is now entirely broken.
Before:

After:

But I am still surprised why AG Grid broke this way, considering the docs have:

The docs do imply that sizeColumnsToFit
and flex
can be used together, and we may be not discovering the root issue with our hotfix approach.
Sure, maybe we can explore that. But still, if the library's sane, no amount of reasonable tinkering with the options should result in a blank table, so I am calling it 🤡 in AG Grid. |
ui.aggrid
I changed this PR to use the "autoSizeStrategy" - just to notice that this breaks when adding |
My current conclusion would be:
|
I'm fine with this PR as it is, because we are at a state where if the config is invalid, console errors are produced. Still though, no warnings, when doing On a separate note, I'm considering to create a mechanism where browser warnings and errors are logged to the Python console. AG Grid will be a top user of this functionality. |
Motivation
In #5276 we noticed that
ui.aggrid
's column auto-sizing break in the presence of flex columns.Implementation
This PR conditionally ignores theauto_size_columns
parameter if any column has aflex
attribute.This PR uses the "autoSizeStrategy" to implement the
auto_size_columns
parameter instead of calling a JavaScript function on size change.Progress