Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable: showHeaders={false} option #4337

Closed
rpspall opened this issue May 2, 2023 · 5 comments · Fixed by #4387
Closed

DataTable: showHeaders={false} option #4337

rpspall opened this issue May 2, 2023 · 5 comments · Fixed by #4387
Assignees
Labels
Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@rpspall
Copy link

rpspall commented May 2, 2023

Describe the feature you would like to see added

Would like a DataGrid attribute that simply says "Hide Headers" or maybe on an individual column (but that doesn't make sense as I would have to add multiple times

@rpspall rpspall added Status: Discussion Issue or pull request needs to be discussed by Core Team Type: New Feature Issue contains a new feature or new component request labels May 2, 2023
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 2, 2023
@melloware
Copy link
Member

melloware commented May 3, 2023

@rpspall what component is DataGrid? I only see DataTable and DataView?

If you mean Datatable each column has a hidden property: http://localhost:3000/datatable/#api.Column.props.hidden

Or do you mean you only want to hide the column header?

If so simply do headerStyle={{ display: 'none' }} to hide individual column header

@melloware melloware added Resolution: Needs More Information More information about the issue is needed to find a correct solution and removed Type: New Feature Issue contains a new feature or new component request Status: Discussion Issue or pull request needs to be discussed by Core Team Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels May 3, 2023
@melloware
Copy link
Member

Example showing column headers being hidden: https://stackblitz.com/edit/react-aea48y

@rpspall
Copy link
Author

rpspall commented May 3, 2023

I want to hide the Column Header, and the solution you provide is very simple - thank you...

Really don't want to sound ungrateful as that solution works well, but...

It would still be nice to have a single flag for the entire grid that states "hideColumnHeaders"! Developer / API usability is often overlooked or traded off for functionality! Based on the "Don't Repeat Yourself" principal, why should I have to configure each column to hide its header (repetition), when it only makes sense to hide all column headers or no column headers :-)

Again, thank you for the solution.

@melloware melloware added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team and removed Resolution: Needs More Information More information about the issue is needed to find a correct solution labels May 3, 2023
@melloware melloware changed the title DataGrid: HideColumnHeader option DataTable: HideColumnHeader option May 3, 2023
@melloware
Copy link
Member

Agreed this seems like a reasonable setting.

@melloware melloware changed the title DataTable: HideColumnHeader option DataTable: showHeaders={false} option May 3, 2023
melloware added a commit to melloware/primereact that referenced this issue May 11, 2023
@melloware melloware self-assigned this May 11, 2023
@melloware melloware added this to the 9.4.0 milestone May 11, 2023
@melloware
Copy link
Member

OK PR submitted this is better because it prevents even rendering the TH at all in the DOM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants