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 throwWhenFrozenNotAllViewable grid option to avoid throwing #882

Merged
merged 1 commit into from
Oct 25, 2023
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
6 changes: 6 additions & 0 deletions src/models/gridOption.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ export interface GridOption<C extends BaseColumn = BaseColumn> {
/** Defaults to false, when set to True will sync the column cell resize & apply the column width */
syncColumnCellResize?: boolean;

/**
* Defaults to false, should we throw an erro when frozenColumn is wider than the grid viewport width.
* When that happens the unfrozen section on the right is in a phantom area that is not viewable neither clickable unless we enable double-scroll on the grid container.
*/
throwWhenFrozenNotAllViewable?: boolean;

/** What is the top panel height in pixels (only type the number) */
topPanelHeight?: number;

Expand Down
3 changes: 2 additions & 1 deletion src/slick.grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
frozenColumn: -1,
frozenRow: -1,
frozenRightViewportMinWidth: 100,
throwWhenFrozenNotAllViewable: false,
fullWidthRows: false,
multiColumnSort: false,
numberedMultiColumnSort: false,
Expand Down Expand Up @@ -1119,7 +1120,7 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e

if (this.hasFrozenColumns()) {
const cWidth = Utils.width(this._container) || 0;
if (cWidth > 0 && this.canvasWidthL > cWidth) {
if (cWidth > 0 && this.canvasWidthL > cWidth && this._options.throwWhenFrozenNotAllViewable) {
throw new Error('[SlickGrid] Frozen columns cannot be wider than the actual grid container width. '
+ 'Make sure to have less columns freezed or make your grid container wider');
}
Expand Down