Skip to content

Commit

Permalink
fix(GridState): calling getAssociatedGridColumns should extend column
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
ghiscoding committed Jun 29, 2023
1 parent f1b7998 commit 3ebd927
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/common/src/services/gridState.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
});
}
});
Expand Down

0 comments on commit 3ebd927

Please sign in to comment.