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

Frozen Columns support for Column Groups #107

Closed
MPanahandeh opened this issue Sep 20, 2017 · 8 comments
Closed

Frozen Columns support for Column Groups #107

MPanahandeh opened this issue Sep 20, 2017 · 8 comments
Assignees
Labels
Type: New Feature Issue contains a new feature or new component request
Milestone

Comments

@MPanahandeh
Copy link

MPanahandeh commented Sep 20, 2017

Something goes wrong with the column Name in my data grid when I use Frozen specification with Column Grouping. I have the first column repeated, but If I disable frozen config in my table it will be fine.

image

Code:
https://github.com/MPanahandeh/time-tracker

@cagataycivici
Copy link
Member

Please provide a test code that we can run.

@MPanahandeh
Copy link
Author

MPanahandeh commented Sep 21, 2017

I added just two rows of mock data to the github link I had provided.
https://github.com/MPanahandeh/time-tracker
$ npm install
$ npm start
If you comment out lines like what I did in data-grid.jsx, grid works normally but no more frozen column

 render() {
    this.initialColumns()
    const headerGroup = DateHeader(this.frozenWidth, this.props.dateArray)
    return (
      <DataTable
        sortable
        // header='Time tracking'
        value={this.props.model}
        scrollable
        scrollHeight='580px'
        style={{
          marginTop: '30px',
          width: `${this.tableWidth}px`,
          fontSize: '15px',
        }}
        // frozenWidth={`${this.frozenWidth}px`}
        // unfrozenWidth={`${this.tableWidth - this.frozenWidth}px`}
        // headerColumnGroup={DateHeader(this.props.dateArray)}
        headerColumnGroup={headerGroup}
      >
        {this.columns}
      </DataTable>
    )
  }

and

  this.columns.unshift(
      <Column
        sortable
        key={0}
        body={NameCell}
        field='name'
        header='Name'
        style={{ width: this.frozenWidth }}
        // frozen
      />,
    )

@cagataycivici
Copy link
Member

We did this for PrimeNG lately and need to do some changes for PrimeReact as well, will do it for 1.0.2.

@cagataycivici cagataycivici self-assigned this Oct 9, 2017
@cagataycivici cagataycivici changed the title Using Column Group with Frozen Columns Frozen Columns support for Column Groups Oct 9, 2017
@cagataycivici cagataycivici added the Type: New Feature Issue contains a new feature or new component request label Oct 9, 2017
@cagataycivici cagataycivici added this to the 1.0.2 milestone Oct 9, 2017
@cagataycivici
Copy link
Member

Added headerColumnGroup and footerColumnGroup properties

@cagataycivici
Copy link
Member

render() {
        let headerGroup = <ColumnGroup>
                            <Row>
                                <Column header="Sale Rate" colSpan={4} />
                            </Row>
                            <Row>
                                <Column header="Sales" colSpan={2} />
                                <Column header="Profits" colSpan={2} />
                            </Row>
                            <Row>
                                <Column header="Last Year" field="lastYearSale" sortable={true}/>
                                <Column header="This Year" />
                                <Column header="Last Year" />
                                <Column header="This Year" />
                            </Row>
                        </ColumnGroup>;

       let footerGroup = <ColumnGroup>
                            <Row>
                                <Column footer="Totals:" colSpan={3} />
                                <Column footer="$506,202" />
                                <Column footer="$531,020" />
                            </Row>
                         </ColumnGroup>;
                         
     let frozenHeaderColumnGroup = <ColumnGroup>
                         <Row>
                             <Column header="Brand" rowSpan={3} />
                         </Row>
                     </ColumnGroup>;
     
        return (
            <div>
                    <DataTable value={this.state.sales} headerColumnGroup={headerGroup} scrollable={true} frozenHeaderColumnGroup={frozenHeaderColumnGroup}
                                                        footerColumnGroup={footerGroup} 
                                                        scrollHeight="200px" frozenWidth="200px" unfrozenWidth="600px">                        
                        <Column field="brand" frozen={true} />
                        <Column field="lastYearSale" />
                        <Column field="thisYearSale" sortable={true}/>
                        <Column field="lastYearProfit" sortable={true}/>
                        <Column field="thisYearProfit" sortable={true}/>
                    </DataTable>
                </div>
            </div>
        );
    }

@claudv
Copy link

claudv commented Feb 19, 2021

This seems to be broken on PrimeReact 6.

The above example produces

image

Any suggestion?

@mertsincan
Copy link
Member

Hi @claudv,

Thanks a lot for your report. On 7.0, I'll reimplement scrollable DataTables like in primevue;
https://primefaces.org/primevue/showcase/#/datatable/scroll

If the problem persists after 7.0, please reopen this issue.

Best Regards,

@hernanbruno97
Copy link

hernanbruno97 commented Aug 20, 2024

Hi, it looks like still not working or got broken on newer versions
I'm using primereact 10.8.2 and react 18.2.0
Here is an example of what I am trying to do ( I set many columns to demonstrate the issue )
https://stackblitz.com/edit/bsrhdi-k1g8w3?file=src%2FApp.jsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Feature Issue contains a new feature or new component request
Projects
None yet
Development

No branches or pull requests

5 participants