primefaces / primefaces/primereact

Datatable: Reset Column and Table Widths Programmatically

Open
#2,879 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Enhancement
Dominant language
CSS
Stars
8.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Describe the feature you would like to see added

I would like to see a width reset function that could be triggered programmatically that resets the table and columns to their original widths. If a css width is specified,. that should be the width they are reset to.

Is your feature request related to a problem?

Yes, there is no simple method method of resetting the table and column widths. Something like this.

Describe the solution you'd like

A resetWidths() function that would reset all of the column and table widths to their original state.

Describe alternatives you have considered

This is a simplified version of the solution that we are currently using on our site. It kinda works, but it leaves a giant space to the right of the columns.

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked CodeSandbox examples, especially DataTableColResizeDemo.js, and trace how column resizing currently changes table and column widths. Define the resetWidths() behavior around the original or CSS-specified widths, including removal of the extra right-side space. Done means the table and all columns return to those widths when the method is triggered.

Written by the indexing model from the issue text.

Assessment

Tech stack
react
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.