Skip to content

Commit

Permalink
Fix #3946: TreeTable allow header to be template (#3947)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Apr 27, 2023
1 parent 4a13425 commit 7386d59
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions components/lib/treetable/TreeTableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ export const TreeTableHeader = React.memo((props) => {
return null;
};

const createTitle = (column, options) => {
const title = ObjectUtils.getJSXElement(getColumnProp(column, 'header'), { props: options });

return <span className="p-column-title">{title}</span>;
};

const createHeaderCell = (column, options) => {
let filterElement;

Expand Down Expand Up @@ -231,7 +237,7 @@ export const TreeTableHeader = React.memo((props) => {

const headerTooltip = getColumnProp(column, 'headerTooltip');
const hasTooltip = ObjectUtils.isNotEmpty(headerTooltip);

const title = createTitle(column, options);
const resizer = createResizer(column);

return (
Expand All @@ -253,7 +259,7 @@ export const TreeTableHeader = React.memo((props) => {
onDrop={(e) => onDrop(e, column)}
>
{resizer}
<span className="p-column-title">{getColumnProp(column, 'header')}</span>
{title}
{sortIconElement}
{sortBadge}
{filterElement}
Expand Down

0 comments on commit 7386d59

Please sign in to comment.