Skip to content
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
10 changes: 3 additions & 7 deletions packages/common/src/core/__tests__/slickGrid.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,7 @@ describe('SlickGrid core file', () => {
expect(styleElm?.getAttribute('nonce')).toBe('test-nonce');
});

it('should display a console warning when Row Detail is enabled with `rowTopOffsetRenderType` is set to "transfrom"', () => {
const consoleWarnSpy = vi.spyOn(console, 'warn').mockReturnValue();

it('should auto-fallback to top when Row Detail is enabled with `rowTopOffsetRenderType` set to "transform"', () => {
document.body.style.zoom = '90%';
const columns = [{ id: 'firstName', field: 'firstName', name: 'First Name' }] as Column[];
grid = new SlickGrid<any, Column>(
Expand All @@ -197,9 +195,7 @@ describe('SlickGrid core file', () => {
grid.init();

expect(grid).toBeTruthy();
expect(consoleWarnSpy).toHaveBeenCalledWith(
expect.stringContaining('[Slickgrid-Universal] `rowTopOffsetRenderType` should be set to "top" when using either RowDetail and/or RowSpan')
);
expect(grid.getOptions().rowTopOffsetRenderType).toBe('top');
});

it('should display a console warning when RowSpan is enabled with `rowTopOffsetRenderType` is set to "transfrom"', () => {
Expand All @@ -218,7 +214,7 @@ describe('SlickGrid core file', () => {

expect(grid).toBeTruthy();
expect(consoleWarnSpy).toHaveBeenCalledWith(
expect.stringContaining('[Slickgrid-Universal] `rowTopOffsetRenderType` should be set to "top" when using either RowDetail and/or RowSpan')
expect.stringContaining('[Slickgrid-Universal] `rowTopOffsetRenderType` should be set to "top" when using RowSpan')
);
});

Expand Down
10 changes: 8 additions & 2 deletions packages/common/src/core/slickGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,9 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
'SlickGrid relies on the `rowHeight` grid option to do row positioning & calculation and when zoom is not 100% then calculation becomes all offset.'
);
}
if (this._options.rowTopOffsetRenderType === 'transform' && (this._options.enableCellRowSpan || this._options.enableRowDetailView)) {
if (this._options.rowTopOffsetRenderType === 'transform' && this._options.enableCellRowSpan) {
console.warn(
'[Slickgrid-Universal] `rowTopOffsetRenderType` should be set to "top" when using either RowDetail and/or RowSpan since "transform" is known to have UI issues.'
'[Slickgrid-Universal] `rowTopOffsetRenderType` should be set to "top" when using RowSpan since "transform" is known to have UI issues.'
);
}
this.finishInitialization();
Expand Down Expand Up @@ -3846,6 +3846,12 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
if (this._options.autoHeight) {
this._options.leaveSpaceForNewRows = false;
}

// Row Detail relies on absolute top-based row positioning; force a safe fallback.
if (this._options.rowTopOffsetRenderType === 'transform' && this._options.enableRowDetailView) {
this._options.rowTopOffsetRenderType = 'top';
}

// make sure the freeze is also valid without breaking the UI (e.g. we can't left freeze columns wider than visible left canvas width)
if (!this.validateColumnFreezeWidth(this._options.frozenColumn)) {
this._options.frozenColumn = this._prevFrozenColumnIdx < this._options.frozenColumn! ? this._prevFrozenColumnIdx : -1;
Expand Down
Loading