From fb2a517838089c39d8a8252aa91698766e92c87e Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Sat, 15 May 2021 13:04:59 +0300 Subject: [PATCH] Fixed #1259 - Filter column is not frozen --- src/components/datatable/HeaderCell.vue | 7 +++++++ src/components/datatable/TableHeader.vue | 4 +++- src/components/treetable/HeaderCell.vue | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/datatable/HeaderCell.vue b/src/components/datatable/HeaderCell.vue index 2a32d7d75..8cdb2ecf8 100644 --- a/src/components/datatable/HeaderCell.vue +++ b/src/components/datatable/HeaderCell.vue @@ -165,6 +165,13 @@ export default { } this.styleObject.left = left + 'px'; } + + let filterRow = this.$el.parentElement.nextElementSibling; + if (filterRow) { + let index = DomHandler.index(this.$el); + filterRow.children[index].style.left = this.styleObject.left; + filterRow.children[index].style.right = this.styleObject.right; + } } }, onHeaderCheckboxChange(event) { diff --git a/src/components/datatable/TableHeader.vue b/src/components/datatable/TableHeader.vue index e3de5f5f0..3bb49a185 100755 --- a/src/components/datatable/TableHeader.vue +++ b/src/components/datatable/TableHeader.vue @@ -120,7 +120,9 @@ export default { return col.props ? ((col.type.props[prop].type === Boolean && col.props[prop] === '') ? true : col.props[prop]) : null; }, getFilterColumnHeaderClass(column) { - return ['p-filter-column', this.columnProp(column, 'filterHeaderClass'), this.columnProp(column, 'class')]; + return ['p-filter-column', this.columnProp(column, 'filterHeaderClass'), this.columnProp(column, 'class'), { + 'p-frozen-column': this.columnProp(column, 'frozen') + }]; }, getFilterColumnHeaderStyle(column) { return [this.columnProp(column, 'filterHeaderStyle'), this.columnProp(column, 'style')]; diff --git a/src/components/treetable/HeaderCell.vue b/src/components/treetable/HeaderCell.vue index b2a850f8a..4a7cc1a45 100644 --- a/src/components/treetable/HeaderCell.vue +++ b/src/components/treetable/HeaderCell.vue @@ -79,6 +79,13 @@ export default { } this.styleObject.left = left + 'px'; } + + let filterRow = this.$el.parentElement.nextElementSibling; + if (filterRow) { + let index = DomHandler.index(this.$el); + filterRow.children[index].style.left = this.styleObject.left; + filterRow.children[index].style.right = this.styleObject.right; + } } }, onClick(event) {