Skip to content

Commit

Permalink
fix: add autoResize.autoHeight to resize by dataset length (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding authored Jan 25, 2025
1 parent c68b606 commit 9b91f6a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/examples/slickgrid/Example28.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export default class Example28 extends React.Component<Props, State> {

const gridOptions: GridOption = {
autoResize: {
autoHeight: false,
container: '#demo-container',
rightPadding: 10
},
Expand Down
5 changes: 5 additions & 0 deletions src/slickgrid-react/components/slickgrid-react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,11 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
if (this._isLocalGrid && this._gridOptions?.enableEmptyDataWarningMessage) {
this.displayEmptyDataWarning(currentPageRowItemCount === 0);
}

// when autoResize.autoHeight is enabled, we'll want to call a resize
if (this._gridOptions.enableAutoResize && this.resizerService.isAutoHeightEnabled && currentPageRowItemCount > 0) {
this.resizerService.resizeGrid();
}
}

/** Initialize the Pagination Service once */
Expand Down
4 changes: 3 additions & 1 deletion src/slickgrid-react/global-grid-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ export const GlobalGridOptions: Partial<GridOption> = {
autoFitColumnsOnFirstLoad: true,
autoResize: {
applyResizeToContainer: true,
autoHeight: true,
autoHeightRecalcRow: 100,
calculateAvailableSizeBy: 'window',
bottomPadding: 20,
minHeight: 180,
minHeight: 250,
minWidth: 300,
rightPadding: 0
},
Expand Down

0 comments on commit 9b91f6a

Please sign in to comment.