From 4120d5ca47eaaf74b001819dcaca2b5a510c50b3 Mon Sep 17 00:00:00 2001 From: Melloware Date: Sun, 18 Dec 2022 09:37:07 -0500 Subject: [PATCH] Fix #3796: TreeTable error in resize expand mode (#3797) --- components/lib/treetable/TreeTable.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/lib/treetable/TreeTable.js b/components/lib/treetable/TreeTable.js index d6151bd79d..77f40f179f 100644 --- a/components/lib/treetable/TreeTable.js +++ b/components/lib/treetable/TreeTable.js @@ -2,7 +2,7 @@ import * as React from 'react'; import PrimeReact, { FilterMatchMode, FilterService } from '../api/Api'; import { useEventListener } from '../hooks/Hooks'; import { Paginator } from '../paginator/Paginator'; -import { classNames, DomHandler, ObjectUtils } from '../utils/Utils'; +import { DomHandler, ObjectUtils, classNames } from '../utils/Utils'; import { TreeTableBody } from './TreeTableBody'; import { TreeTableFooter } from './TreeTableFooter'; import { TreeTableHeader } from './TreeTableHeader'; @@ -18,6 +18,7 @@ export const TreeTable = React.forwardRef((props, ref) => { const [filtersState, setFiltersState] = React.useState(props.filters); const [columnOrderState, setColumnOrderState] = React.useState([]); const elementRef = React.useRef(null); + const tableRef = React.useRef(null); const resizerHelperRef = React.useRef(null); const reorderIndicatorUpRef = React.useRef(null); const reorderIndicatorDownRef = React.useRef(null); @@ -345,7 +346,7 @@ export const TreeTable = React.forwardRef((props, ref) => { resizeColGroup(scrollableBodyTable, resizeColumnIndex, newColumnWidth, null); resizeColGroup(scrollableFooterTable, resizeColumnIndex, newColumnWidth, null); } else { - table.style.width = table.offsetWidth + delta + 'px'; + tableRef.current.style.width = tableRef.current.offsetWidth + delta + 'px'; resizeColumn.current.style.width = newColumnWidth + 'px'; } } @@ -930,7 +931,7 @@ export const TreeTable = React.forwardRef((props, ref) => { return (
- +
{header} {footer} {body}