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: frozen columns + column groups not properly rendered #9854

Open
Rapster opened this issue Feb 28, 2023 · 6 comments · May be fixed by #9872
Open

DataTable: frozen columns + column groups not properly rendered #9854

Rapster opened this issue Feb 28, 2023 · 6 comments · May be fixed by #9872
Assignees
Labels
🐞 defect Bug...Something isn't working

Comments

@Rapster
Copy link
Member

Rapster commented Feb 28, 2023

Describe the bug

Having a table with frozen columns and columns groups doesn't render properly

Reproducer

Update group.xhtml from showcase with:

                <p:dataTable id="tblSales" var="sale" value="#{dtGroupView.sales}" frozenColumns="1" scrollable="true" scrollWidth="500">
                    <f:facet name="header">
                        <h:outputText value="Product Sales"/>
                    </f:facet>

                    <p:columnGroup type="frozenHeader">
                        <p:row>
                            <p:column rowspan="3" headerText="Product"/>
                            <p:column colspan="4" headerText="Sale Rate"/>
                        </p:row>
                        <p:row>
                            <p:column colspan="2" headerText="Sales"/>
                            <p:column colspan="2" headerText="Profit"/>
                        </p:row>
                        <p:row>
                            <p:column headerText="Last Year"/>
                            <p:column headerText="This Year"/>
                            <p:column headerText="Last Year"/>
                            <p:column headerText="This Year"/>
                        </p:row>
                    </p:columnGroup>

                    <p:column>
                        <h:outputText value="#{sale.manufacturer}"/>
                    </p:column>
                    <p:column>
                        <h:outputText value="#{sale.lastYearProfit}%"/>
                    </p:column>
                    <p:column>
                        <h:outputText value="#{sale.thisYearProfit}%"/>
                    </p:column>
                    <p:column>
                        <h:outputText value="#{sale.lastYearSale}">
                            <f:convertNumber type="currency" />
                        </h:outputText>
                    </p:column>
                    <p:column>
                        <h:outputText value="#{sale.thisYearSale}">
                            <f:convertNumber type="currency" />
                        </h:outputText>
                    </p:column>

                    <p:columnGroup type="frozenFooter">
                        <p:row>
                            <p:column colspan="3" style="text-align:right" footerText="Totals:"/>
                            <p:column>
                                <f:facet name="footer">
                                    <h:outputText value="#{dtGroupView.lastYearTotal}">
                                        <f:convertNumber type="currency" currencySymbol="$"/>
                                    </h:outputText>
                                </f:facet>
                            </p:column>
                            <p:column>
                                <f:facet name="footer">
                                    <h:outputText value="#{dtGroupView.thisYearTotal}">
                                        <f:convertNumber type="currency" currencySymbol="$"/>
                                    </h:outputText>
                                </f:facet>
                            </p:column>
                        </p:row>
                    </p:columnGroup>
                    <f:facet name="footer">
                        <h:outputText value="Data between 2013-2014"/>
                    </f:facet>
</p:dataTable>

You'll end up with this:

image

Expected behavior

I honestly have no idea 😅 But not this for sure, at least I expect one column to be frozen and the rest in a scroll view.

Note on the side: I have plan to do some "massive" refactoring regarding how ColumnGroup works (i'll try to keep some backward compatibility but no guarantee), see #6409, so if there is an easy fix let's welcome it otherwise maybe wait for the refacto

PrimeFaces edition

Community

PrimeFaces version

13.0

Theme

No response

JSF implementation

Mojarra

JSF version

2.3

Java version

8

Browser(s)

Chrome 110.0

@Rapster Rapster added 🐞 defect Bug...Something isn't working ‼️ needs-triage Issue needs triaging labels Feb 28, 2023
@Rapster Rapster changed the title DataTable: frozen columns + columns not properly rendered DataTable: frozen columns + column groups not properly rendered Feb 28, 2023
@melloware
Copy link
Member

Yep there a few open frozen columns bugs so this doesn't surprise me.

@melloware melloware removed the ‼️ needs-triage Issue needs triaging label Mar 1, 2023
@melloware
Copy link
Member

@Rapster I just don't think frozen columns are designed to work with column groups. There are way too many difficult things to support with this even from looking at your screenshot.

I think we need to do a better job if frozen columns are being used we throw errors if someone is using HeaderRow or ColumnGroups stating it's "not supported". Thoughts?

@Rapster
Copy link
Member Author

Rapster commented Jan 3, 2024

I think ColumnGroup#type with frozenFooter and frozenHeader were meant exactly for this use case (to have col groups + frozen columns) I think it's been fixed in my MR for new col groups impl

@melloware
Copy link
Member

OK so i am not sure how this will work if you have the following

  1. <p:column colspan="2" headerText="A + B"/> a column group that spans 2 columns A and B
  2. Column A and Column B
  3. frozenColumns=1. How can you freeze Column A but not Column B how does the ColumnGroup split "half" a frozen Column?

@Rapster
Copy link
Member Author

Rapster commented Jan 3, 2024

TBH I don't know, I know it works in the new version, but I didn't try every possibilities... Whenever people will show interest in this, I'll give it a try

@melloware
Copy link
Member

OK I guess that is why I was saying this seems really difficult to support without people opening more bugs saying "this doesn't work".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 defect Bug...Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants