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

Sorting does not work when you are using Column Group feature #115

Closed
MPanahandeh opened this issue Sep 27, 2017 · 2 comments
Closed

Sorting does not work when you are using Column Group feature #115

MPanahandeh opened this issue Sep 27, 2017 · 2 comments
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.

Comments

@MPanahandeh
Copy link

No description provided.

@cagataycivici cagataycivici added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Oct 14, 2017
@cagataycivici cagataycivici self-assigned this Oct 14, 2017
@cagataycivici cagataycivici added this to the 1.1.0 milestone Oct 14, 2017
@cagataycivici cagataycivici added Type: Bug Issue contains a defect related to a specific component. and removed Status: Pending Review Issue or pull request is being reviewed by Core Team labels Oct 16, 2017
@cagataycivici cagataycivici removed this from the 1.1.0 milestone Oct 16, 2017
@cagataycivici
Copy link
Member

cagataycivici commented Oct 16, 2017

When using column groups, define sort props inside groups not the direct children;

        let headerGroup = <ColumnGroup>
                            <Row>
                                <Column header="Brand" rowSpan={3} field="brand" sortable={true}/>
                                <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" field="thisYearSale" sortable={true}/>
                                <Column header="Last Year" field="lastYearProfit" sortable={true}/>
                                <Column header="This Year" field="thisYearProfit" sortable={true}/>
                            </Row>
                        </ColumnGroup>;

       let footerGroup = <ColumnGroup>
                            <Row>
                                <Column footer="Totals:" colSpan={3} />
                                <Column footer="$506,202" />
                                <Column footer="$531,020" />
                            </Row>
                         </ColumnGroup>;
render() {
                ( return <DataTable value={this.state.sales} headerColumnGroup={headerGroup}
                                                        footerColumnGroup={footerGroup}>                        
                        <Column field="brand" />
                        <Column field="lastYearSale" />
                        <Column field="thisYearSale" />
                        <Column field="lastYearProfit" />
                        <Column field="thisYearProfit" />
                    </DataTable> )
}

@MPanahandeh
Copy link
Author

Thank you for the solution, worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

2 participants