Skip to content

Commit

Permalink
fix column resizing for ui.aggrid (fixes #2852)
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed May 13, 2024
1 parent 614ea49 commit 7abda3f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nicegui/elements/aggrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ export default {
methods: {
update_grid() {
this.$el.textContent = "";
this.gridOptions = {
...this.options,
onGridReady: this.auto_size_columns ? (params) => params.api.sizeColumnsToFit() : undefined,
};
this.gridOptions = { ...this.options };
for (const column of this.html_columns) {
if (this.gridOptions.columnDefs[column].cellRenderer === undefined) {
this.gridOptions.columnDefs[column].cellRenderer = (params) => (params.value ? params.value : "");
Expand Down Expand Up @@ -57,6 +54,9 @@ export default {
return runMethod(this.gridOptions.api.getRowNode(row_id), name, args);
},
handle_event(type, args) {
if ((type === "gridReady" || type === "gridSizeChanged") && this.auto_size_columns) {
this.gridOptions.api.sizeColumnsToFit();
}
this.$emit(type, {
value: args.value,
oldValue: args.oldValue,
Expand Down

0 comments on commit 7abda3f

Please sign in to comment.