Skip to content

Commit

Permalink
Fix primefaces#4337: Datatable showHeaders property
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed May 11, 2023
1 parent d4038ca commit c35e657
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
4 changes: 4 additions & 0 deletions components/lib/datatable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,10 @@ export const DataTable = React.forwardRef((inProps, ref) => {
};

const createTableHeader = (options, empty, _isVirtualScrollerDisabled) => {
if (props.showHeaders === false) {
return null;
}

const sortField = getSortField();
const sortOrder = getSortOrder();
const multiSortMeta = [...getMultiSortMeta()];
Expand Down
15 changes: 8 additions & 7 deletions components/lib/datatable/DataTableBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export const DataTableBase = {
__TYPE: 'DataTable',
alwaysShowPaginator: true,
breakpoint: '960px',
checkIcon: null,
cellClassName: null,
cellSelection: false,
checkIcon: null,
className: null,
collapsedRowIcon: null,
columnResizeMode: 'fit',
Expand All @@ -29,12 +29,12 @@ export const DataTableBase = {
expandedRows: null,
exportFilename: 'download',
exportFunction: null,
filterClearIcon: null,
filterDelay: 300,
filterDisplay: 'menu',
filterIcon: null,
filterLocale: undefined,
filters: null,
filterIcon: null,
filterClearIcon: null,
first: 0,
footer: null,
footerColumnGroup: null,
Expand Down Expand Up @@ -67,8 +67,6 @@ export const DataTableBase = {
onFilter: null,
onPage: null,
onRowClick: null,
onRowMouseEnter: null,
onRowMouseLeave: null,
onRowCollapse: null,
onRowDoubleClick: null,
onRowEditCancel: null,
Expand All @@ -77,6 +75,8 @@ export const DataTableBase = {
onRowEditInit: null,
onRowEditSave: null,
onRowExpand: null,
onRowMouseEnter: null,
onRowMouseLeave: null,
onRowReorder: null,
onRowSelect: null,
onRowToggle: null,
Expand All @@ -96,10 +96,10 @@ export const DataTableBase = {
paginatorRight: null,
paginatorTemplate: 'FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown',
removableSort: false,
reorderableColumns: false,
reorderableRows: false,
reorderIndicatorDownIcon: null,
reorderIndicatorUpIcon: null,
reorderableColumns: false,
reorderableRows: false,
resizableColumns: false,
responsiveLayout: 'scroll',
rowClassName: null,
Expand All @@ -124,6 +124,7 @@ export const DataTableBase = {
selectionMode: null,
selectionPageOnly: false,
showGridlines: false,
showHeaders: true,
showRowReorderElement: null,
showSelectAll: true,
showSelectionElement: null,
Expand Down
5 changes: 5 additions & 0 deletions components/lib/datatable/datatable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,11 @@ export interface DataTableProps<TValue extends DataTableValueArray> extends Omit
* @defaultValue false
*/
showGridlines?: boolean | undefined;
/**
* Whether to show headers.
* @defaultValue true
*/
showHeaders?: boolean | undefined;
/**
* Whether to show the select all checkbox inside the datatable's header.
*/
Expand Down

0 comments on commit c35e657

Please sign in to comment.