diff --git a/components/lib/datatable/TableFooter.js b/components/lib/datatable/TableFooter.js index 6409f3a33b..4b9d2314ab 100644 --- a/components/lib/datatable/TableFooter.js +++ b/components/lib/datatable/TableFooter.js @@ -4,11 +4,13 @@ import { ColumnGroupBase } from '../columngroup/ColumnGroupBase'; import { useMergeProps } from '../hooks/Hooks'; import { RowBase } from '../row/RowBase'; import { FooterCell } from './FooterCell'; +import { PrimeReactContext } from '../api/Api'; export const TableFooter = React.memo((props) => { const { ptm, ptmo, cx } = props.ptCallbacks; const mergeProps = useMergeProps(); const getRowProps = (row) => ColumnGroupBase.getCProps(row); + const context = React.useContext(PrimeReactContext); const getColumnGroupProps = () => { return props.footerColumnGroup ? ColumnGroupBase.getCProps(props.footerColumnGroup) : undefined; @@ -68,6 +70,7 @@ export const TableFooter = React.memo((props) => { { role: 'row' }, + RowBase.getProps(row.props, context), getRowPTOptions(row, 'root') ); diff --git a/components/lib/datatable/TableHeader.js b/components/lib/datatable/TableHeader.js index ddac9f50ac..79f9dd0486 100644 --- a/components/lib/datatable/TableHeader.js +++ b/components/lib/datatable/TableHeader.js @@ -7,6 +7,7 @@ import { classNames } from '../utils/Utils'; import { ColumnFilter } from './ColumnFilter'; import { HeaderCell } from './HeaderCell'; import { HeaderCheckbox } from './HeaderCheckbox'; +import { PrimeReactContext } from '../api/Api'; export const TableHeader = React.memo((props) => { const [sortableDisabledFieldsState, setSortableDisabledFieldsState] = React.useState([]); @@ -16,6 +17,7 @@ export const TableHeader = React.memo((props) => { const isMultipleSort = props.sortMode === 'multiple'; const isAllSortableDisabled = isSingleSort && allSortableDisabledState; const { ptm, ptmo, cx } = props.ptCallbacks; + const context = React.useContext(PrimeReactContext); const getColumnProp = (column, name) => { return ColumnBase.getCProp(column, name); @@ -241,6 +243,7 @@ export const TableHeader = React.memo((props) => { { role: 'row' }, + RowBase.getProps(row.props, context), getRowPTOptions(row, 'root') ); diff --git a/components/lib/treetable/TreeTableFooter.js b/components/lib/treetable/TreeTableFooter.js index 70b55c0049..13898d8c66 100644 --- a/components/lib/treetable/TreeTableFooter.js +++ b/components/lib/treetable/TreeTableFooter.js @@ -4,10 +4,12 @@ import { ColumnGroupBase } from '../columngroup/ColumnGroupBase'; import { useMergeProps } from '../hooks/Hooks'; import { RowBase } from '../row/RowBase'; import { ObjectUtils } from '../utils/Utils'; +import { PrimeReactContext } from '../api/Api'; export const TreeTableFooter = React.memo((props) => { const mergeProps = useMergeProps(); const { ptm, ptmo, cx } = props.ptCallbacks; + const context = React.useContext(PrimeReactContext); const getColumnProp = (column, name) => { return ColumnBase.getCProp(column, name); @@ -48,7 +50,7 @@ export const TreeTableFooter = React.memo((props) => { const createFooterRow = (row, index) => { const rowColumns = React.Children.toArray(RowBase.getCProp(row, 'children')); const rowFooterCells = rowColumns.map(createFooterCell); - const footerRowProps = mergeProps(ptm('footerRow', { hostName: props.hostName, role: 'row' })); + const footerRowProps = mergeProps(ptm('footerRow', { hostName: props.hostName, role: 'row' }), RowBase.getProps(row.props, context)); return ( diff --git a/components/lib/treetable/TreeTableHeader.js b/components/lib/treetable/TreeTableHeader.js index d8ffe16f2f..ec4f612635 100644 --- a/components/lib/treetable/TreeTableHeader.js +++ b/components/lib/treetable/TreeTableHeader.js @@ -9,11 +9,13 @@ import { InputText } from '../inputtext/InputText'; import { RowBase } from '../row/RowBase'; import { Tooltip } from '../tooltip/Tooltip'; import { classNames, DomHandler, IconUtils, ObjectUtils } from '../utils/Utils'; +import { PrimeReactContext } from '../api/Api'; export const TreeTableHeader = React.memo((props) => { const mergeProps = useMergeProps(); const { ptm, ptmo, cx } = props.ptCallbacks; const filterTimeout = React.useRef(null); + const context = React.useContext(PrimeReactContext); const getColumnProp = (column, ...args) => { return column ? (typeof args[0] === 'string' ? ColumnBase.getCProp(column, args[0]) : ColumnBase.getCProp(args[0] || column, args[1])) : null; @@ -320,7 +322,7 @@ export const TreeTableHeader = React.memo((props) => { className: classNames(getColumnProp(column, 'headerClassName') || getColumnProp(column, 'className'), cx('headerCell', { headerProps: props, frozen, column, options, getColumnProp, sorted, align })), style: getColumnProp(column, 'headerStyle') || getColumnProp(column, 'style'), tabIndex: sortable ? props.tabIndex : null, - 'aria-sort': ariaSort, + 'aria-sort': ariaSort, //TODO: aria-sort is defined here two times (ariaSort, ariaSortData) ? onClick: (e) => onHeaderClick(e, column), onMouseDown: (e) => onHeaderMouseDown(e, column), onKeyDown: (e) => onHeaderKeyDown(e, column), @@ -376,7 +378,7 @@ export const TreeTableHeader = React.memo((props) => { const createHeaderRow = (row, index) => { const rowColumns = React.Children.toArray(RowBase.getCProp(row, 'children')); const rowHeaderCells = rowColumns.map((col, i) => createHeaderCell(col, { index: i, filterOnly: false, renderFilter: true })); - const headerRowProps = mergeProps(ptm('headerRow', { hostName: props.hostName })); + const headerRowProps = mergeProps(ptm('headerRow', { hostName: props.hostName }), RowBase.getProps(row.props, context)); return (