Skip to content
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

fix: add autoResize.autoHeight to resize by dataset length #457

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading