From 6199896bb9ceb66d29767c35d16f9381c2df49a2 Mon Sep 17 00:00:00 2001 From: melloware Date: Mon, 6 Nov 2023 13:45:21 -0500 Subject: [PATCH] Fix #5252: Treetable frozen column --- components/lib/treetable/TreeTableBase.js | 4 ++-- components/lib/treetable/TreeTableHeader.js | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/components/lib/treetable/TreeTableBase.js b/components/lib/treetable/TreeTableBase.js index c462b52f0e..456672bac7 100644 --- a/components/lib/treetable/TreeTableBase.js +++ b/components/lib/treetable/TreeTableBase.js @@ -172,9 +172,9 @@ const classes = { }), sortBadge: 'p-sortable-column-badge', headerTitle: 'p-column-title', - headerCell: ({ headerProps: props, column, options, getColumnProp, sorted, frozen }) => + headerCell: ({ headerProps: props, frozen, column, options, getColumnProp, sorted }) => options.filterOnly - ? 'p-filter-column' + ? classNames('p-filter-column', { 'p-frozen-column': frozen }) : classNames({ 'p-sortable-column': getColumnProp(column, 'sortable'), 'p-highlight': sorted, diff --git a/components/lib/treetable/TreeTableHeader.js b/components/lib/treetable/TreeTableHeader.js index 531edf4d86..379ed4f274 100644 --- a/components/lib/treetable/TreeTableHeader.js +++ b/components/lib/treetable/TreeTableHeader.js @@ -250,21 +250,22 @@ export const TreeTableHeader = React.memo((props) => { } if (options.filterOnly) { + const frozen = getColumnProp(column, 'frozen'); const headerCellProps = mergeProps( { key: getColumnProp(column, 'columnKey') || getColumnProp(column, 'field') || options.index, - className: classNames(cx('headerCell', { options }), getColumnProp(column, 'filterHeaderClassName')), + className: classNames(cx('headerCell', { options, frozen }), getColumnProp(column, 'filterHeaderClassName')), style: getColumnProp(column, 'filterHeaderStyle') || getColumnProp(column, 'style'), rowSpan: getColumnProp(column, 'rowSpan'), colSpan: getColumnProp(column, 'colSpan'), 'data-p-sortable-column': getColumnProp(column, 'sortable'), 'data-p-resizable-column': props.resizableColumns, - 'data-p-frozen-column': getColumnProp(column, 'frozen') + 'data-p-frozen-column': frozen }, getColumnPTOptions(column, 'root'), getColumnPTOptions(column, 'headerCell', { context: { - frozen: getColumnProp(column, 'frozen') + frozen: frozen } }) ); @@ -293,7 +294,7 @@ export const TreeTableHeader = React.memo((props) => { const resizer = createResizer(column); const headerCellProps = mergeProps( { - className: classNames(getColumnProp(column, 'headerClassName') || getColumnProp(column, 'className'), cx('headerCell', { headerProps: props, column, options, getColumnProp, sorted, frozen })), + className: classNames(getColumnProp(column, 'headerClassName') || getColumnProp(column, 'className'), cx('headerCell', { headerProps: props, frozen, column, options, getColumnProp, sorted })), style: getColumnProp(column, 'headerStyle') || getColumnProp(column, 'style'), tabIndex: getColumnProp(column, 'sortable') ? props.tabIndex : null, onClick: (e) => onHeaderClick(e, column),