From 3ebd927a37a10284a8bd8b666b5ab016decafafb Mon Sep 17 00:00:00 2001 From: ghiscoding Date: Thu, 29 Jun 2023 18:27:29 -0400 Subject: [PATCH] fix(GridState): calling `getAssociatedGridColumns` should extend column - extends the previous PR #1014, but instead of merging all column properties, we will actually skip the `width` property since that property is changed internally by SlickGrid (auto-calculated) and that has an impact when using autoResizeColumnsByCellContent feature (for example it breaks our Salesforce grid that uses `enabledAutoResizeColumnsByCellContent` and uses much thinner column width, if we however skip the width then we make SlickGrid recalculate the width since we use `enabledAutoResizeColumnsByCellContent` and that fixes our problem) --- packages/common/src/services/gridState.service.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/common/src/services/gridState.service.ts b/packages/common/src/services/gridState.service.ts index 923a23ee3..5f26ea24e 100644 --- a/packages/common/src/services/gridState.service.ts +++ b/packages/common/src/services/gridState.service.ts @@ -21,7 +21,6 @@ import type { FilterService } from './filter.service'; import type { SharedService } from './shared.service'; import type { SortService } from './sort.service'; import type { TreeDataService } from './treeData.service'; -import { objectWithoutKey } from './utilities'; // using external non-typed js libraries declare const Slick: SlickNamespace; @@ -221,7 +220,12 @@ export class GridStateService { if (gridColumn?.id) { columns.push({ ...gridColumn, - ...objectWithoutKey(currentColumn, 'columnId') // extend all currentCol proops except "columnId" which isn't needed + cssClass: currentColumn.cssClass || gridColumn.cssClass, + headerCssClass: currentColumn.headerCssClass || gridColumn.headerCssClass, + + // for the width we will only pull the custom width or else nothing + // since we don't want to use the default width that SlickGrid changes internally and that has an impact when using autoResizeColumnsByCellContent + width: currentColumn.width }); } });