Skip to content

Commit

Permalink
Fix primefaces#7050: HeaderCheckbox passthrough
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Aug 15, 2024
1 parent 0c4eeca commit 08ed3b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion components/lib/datatable/HeaderCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,9 @@ export const HeaderCell = React.memo((props) => {
if (props.showSelectAll && getColumnProp('selectionMode') === 'multiple' && props.filterDisplay !== 'row') {
const allRowsSelected = props.allRowsSelected(props.value);

return <HeaderCheckbox hostName={props.hostName} checked={allRowsSelected} onChange={props.onColumnCheckboxChange} disabled={props.empty} ptCallbacks={ptCallbacks} metaData={parentMetaData} unstyled={props.unstyled} />;
return (
<HeaderCheckbox hostName={props.hostName} column={props.column} checked={allRowsSelected} onChange={props.onColumnCheckboxChange} disabled={props.empty} ptCallbacks={ptCallbacks} metaData={parentMetaData} unstyled={props.unstyled} />
);
}

return null;
Expand Down
6 changes: 3 additions & 3 deletions components/lib/datatable/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ export const TableHeader = React.memo((props) => {
});
};

const createCheckbox = (selectionMode) => {
const createCheckbox = (column, selectionMode) => {
if (props.showSelectAll && selectionMode === 'multiple') {
const allRowsSelected = props.allRowsSelected(props.value);

return <HeaderCheckbox hostName={props.hostName} checked={allRowsSelected} onChange={onCheckboxChange} disabled={props.empty} ptCallbacks={props.ptCallbacks} metaData={props.metaData} />;
return <HeaderCheckbox hostName={props.hostName} column={column} checked={allRowsSelected} onChange={onCheckboxChange} disabled={props.empty} ptCallbacks={props.ptCallbacks} metaData={props.metaData} unstyled={props.unstyled} />;
}

return null;
Expand Down Expand Up @@ -209,7 +209,7 @@ export const TableHeader = React.memo((props) => {
const { filterHeaderStyle, style, filterHeaderClassName, className, frozen, columnKey, field, selectionMode, filter } = ColumnBase.getCProps(col);
const colStyle = { ...(filterHeaderStyle || {}), ...(style || {}) };
const colKey = columnKey || field || i;
const checkbox = createCheckbox(selectionMode);
const checkbox = createCheckbox(col, selectionMode);
const filterRow = createFilter(col, filter);
const headerCellProps = mergeProps(
{
Expand Down

0 comments on commit 08ed3b6

Please sign in to comment.