Skip to content

Commit

Permalink
fix: Draggable Grouping drop zone in preheader should take full width (
Browse files Browse the repository at this point in the history
…#1025)

- also use `auto` instead of `100%` to take full width but without being wider than its actual container
  • Loading branch information
ghiscoding committed May 24, 2024
1 parent b82f476 commit 2c0a41f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/models/gridOption.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ export interface GridOption<C extends BaseColumn = BaseColumn> {
/** Extra pre-header panel height (on top of column header) */
preHeaderPanelHeight?: number;

/** Defaults to "auto", extra pre-header panel (on top of column header) width, it could be a number (pixels) or a string ("100%" or "auto") */
preHeaderPanelWidth?: number | string;

/** Do we want to preserve copied selection on paste? */
preserveCopiedSelectionOnPaste?: boolean;

Expand Down
5 changes: 3 additions & 2 deletions src/slick.grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
preHeaderPanelHeight: 25,
showTopPanel: false,
topPanelHeight: 25,
preHeaderPanelWidth: 'auto', // mostly useful for Draggable Grouping dropzone to take full width
formatterFactory: null,
editorFactory: null,
cellFlashingCssClass: 'flashing',
Expand Down Expand Up @@ -1230,7 +1231,7 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
Utils.width(this._footerRowR, this.canvasWidthR);
}
if (this._options.createPreHeaderPanel) {
Utils.width(this._preHeaderPanel, this.canvasWidth);
Utils.width(this._preHeaderPanel, this._options.preHeaderPanelWidth ?? this.canvasWidth);
}
Utils.width(this._viewportTopL, this.canvasWidthL);
Utils.width(this._viewportTopR, this.viewportW - this.canvasWidthL);
Expand All @@ -1257,7 +1258,7 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
}

if (this._options.createPreHeaderPanel) {
Utils.width(this._preHeaderPanel, this.canvasWidth);
Utils.width(this._preHeaderPanel, this._options.preHeaderPanelWidth ?? this.canvasWidth);
}
Utils.width(this._viewportTopL, '100%');

Expand Down

0 comments on commit 2c0a41f

Please sign in to comment.