From 5a2e4e7ab4ecd25f9de73cf0e50f7cfbb7e17789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Belniak?= Date: Tue, 23 Apr 2024 03:16:26 +0200 Subject: [PATCH] TreeTable: call customer sortFunction for column set as sortField (#6436) --- components/lib/treetable/TreeTable.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/lib/treetable/TreeTable.js b/components/lib/treetable/TreeTable.js index 3116b163f0..ba51125892 100644 --- a/components/lib/treetable/TreeTable.js +++ b/components/lib/treetable/TreeTable.js @@ -875,6 +875,13 @@ export const TreeTable = React.forwardRef((inProps, ref) => { const filters = (localState && localState.filters) || getFilters(); const sortField = (localState && localState.sortField) || getSortField(); const multiSortMeta = (localState && localState.multiSortMeta) || getMultiSortMeta(); + const columns = getColumns(); + const sortColumn = columns.find((col) => getColumnProp(col, 'field') === sortField); + + if (sortColumn) { + columnSortable.current = getColumnProp(sortColumn, 'sortable'); + columnSortFunction.current = getColumnProp(sortColumn, 'sortFunction'); + } if (ObjectUtils.isNotEmpty(filters) || props.globalFilter) { data = filterLocal(data, filters);