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
AG Grid doesn't resize correctly with its container #2852
Comments
So something like this is part of what inspired me to create #2822 since i was having so much trouble controlling the size of the grid. Rows would stick with original window size, they wouldn't flex correctly, etc. until i dropped a lot of the tailwind-css elements, went directly to style with hard pixel values, and passed " 'resizeable':True" explicitly in defaultColDef of ui.aggrid. I attempted to expand the container size and have AgGrid match container dimensions but had to drop that after a while and do like you did and resize the table directly. I'm working on a client project right now with nicegui, but when i get to a stopping point i was planning on investigating anyways since i'll be needing nicegui for future work. |
I have also encountered this issue. I resolved it by adding the following code in aggrid.js. Hope this helps. onGridSizeChanged: this.auto_size_columns ? (params) => params.api.sizeColumnsToFit() : undefined, |
Nice, @wasabismile! We can use this workaround by passing the "onGridSizeChange" event handler to the options dictionary: with ui.card().style('width: 500px') as card:
ui.aggrid({
'columnDefs': [{'field': 'name'}],
'rowData': [{'name': 'Alice'}],
':onGridSizeChanged': '(params) => params.api.sizeColumnsToFit()',
})
ui.checkbox('Wide', on_change=lambda e: card.style('width: 1000px' if e.value else 'width: 500px')) |
I managed to integrate this solution into aggrid.js, so we can finally resolve this issue. 🚀 |
Discussed in #2850
Originally posted by tz301 April 8, 2024
Question
I have use aggrid combined with left drawer. When click button to show/hide the left drawer, aggrid style is strange, not fully fill the width.
This can be reproduced with this tiny example:
Strangely it doesn't happen when resizing the AG Grid directly:
The text was updated successfully, but these errors were encountered: