diff --git a/components/lib/treetable/TreeTableBase.js b/components/lib/treetable/TreeTableBase.js index f8353c6e5c..a027d1a5bc 100644 --- a/components/lib/treetable/TreeTableBase.js +++ b/components/lib/treetable/TreeTableBase.js @@ -187,10 +187,11 @@ const classes = { tbody: 'p-treetable-tbody', tfoot: 'p-treetable-tfoot', emptyMessage: 'p-treetable-emptymessage', - bodyCell: ({ bodyProps: props, editingState }) => + bodyCell: ({ bodyProps: props, editingState, align }) => classNames({ 'p-editable-column': props.editor, - 'p-cell-editing': props.editor ? editingState : false + 'p-cell-editing': props.editor ? editingState : false, + [`p-align-${align}`]: !!align }), sortBadge: 'p-sortable-column-badge', headerTitle: 'p-column-title', diff --git a/components/lib/treetable/TreeTableBodyCell.js b/components/lib/treetable/TreeTableBodyCell.js index 964ec9abfd..da69fa285c 100644 --- a/components/lib/treetable/TreeTableBodyCell.js +++ b/components/lib/treetable/TreeTableBodyCell.js @@ -226,10 +226,11 @@ export const TreeTableBodyCell = (props) => { ); + const align = getColumnProp('align'); /* eslint-enable */ const bodyCellProps = mergeProps( { - className: classNames(bodyClassName || props.className, cx('bodyCell', { bodyProps: props, editingState })), + className: classNames(bodyClassName || props.className, cx('bodyCell', { bodyProps: props, editingState, align })), style, onClick: (e) => onClick(e), onKeyDown: (e) => onKeyDown(e) diff --git a/components/lib/treetable/TreeTableHeader.js b/components/lib/treetable/TreeTableHeader.js index f50c9a9a03..e415b6e4ec 100644 --- a/components/lib/treetable/TreeTableHeader.js +++ b/components/lib/treetable/TreeTableHeader.js @@ -284,7 +284,7 @@ export const TreeTableHeader = React.memo((props) => { const multipleSorted = multiSortMetaData !== null; const sorted = getColumnProp(column, 'sortable') && (singleSorted || multipleSorted); const frozen = getColumnProp(column, 'frozen'); - const align = getColumnProp(column, 'alignHeader') || getColumnProp(column, 'align'); + const align = getColumnProp(column, 'alignHeader'); let sortOrder = 0; if (singleSorted) sortOrder = props.sortOrder;