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

SelectCheckboxMenu: Custom rendering broken when used as DataTable filter in a ColumnGroup #11421

Closed
ltlBeBoy opened this issue Feb 11, 2024 · 10 comments · Fixed by #11805
Closed
Assignees
Labels
🐞 defect Bug...Something isn't working
Milestone

Comments

@ltlBeBoy
Copy link
Contributor

ltlBeBoy commented Feb 11, 2024

Describe the bug

When a SelectCheckboxMenu with custom rendering is used as a DataTable filter, and the header of the table is specified within a ColumnGroup, then the rendering of the SelectCheckboxMenu is broken. The column with the selection labels is empty, and an additional column, which contains the value of the header facet, is rendered for each selection item.

SelectCheckboxMenu-broken

Reproducer

primefaces-test-master.zip

Expected behavior

There should be just one column with the selection labels.

PrimeFaces edition

Community

PrimeFaces version

13.0.5

Theme

No response

JSF implementation

Mojarra

JSF version

2.2

Java version

1.8.0_202-b08

Browser(s)

Chromium 121.0.6167.85, Firefox 115.7.0esr

@ltlBeBoy ltlBeBoy added ‼️ needs-triage Issue needs triaging 🐞 defect Bug...Something isn't working labels Feb 11, 2024
@melloware
Copy link
Member

I think we have seen other issues like this in the past with rows and columns or TR TDs conflicting.

@melloware
Copy link
Member

@ltlBeBoy are you debugging this?

@melloware melloware removed the ‼️ needs-triage Issue needs triaging label Feb 12, 2024
@ltlBeBoy
Copy link
Contributor Author

@melloware Yes, I will take a look. I have an idea...But I'm at the client's today and tomorrow to install a new software version.

@melloware
Copy link
Member

Any update @ltlBeBoy ?

@ltlBeBoy
Copy link
Contributor Author

ltlBeBoy commented Mar 9, 2024

@melloware I'm currently handling a critical client update that's taking up all my time. This has delayed work on the rendering issue, but I plan to get back to it as soon as possible. Thanks for your patience.

@ltlBeBoy
Copy link
Contributor Author

ltlBeBoy commented Apr 24, 2024

@melloware I found the source of the problem, but I have no clue how to fix it. The rendering mistake occurs during the encoding of the column in the SelectCheckboxMenu, specifically at org.primefaces.component.column.ColumnRenderer#encodeEnd(FacesContext, UIComponent):

    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
        Column column = (Column) component;
        String helperKey = (String) context.getAttributes().get(Constants.HELPER_RENDERER);

        if (helperKey != null) {
            HelperColumnRenderer renderer = RENDERERS.get(helperKey);

            if (renderer != null) {
                renderer.encode(context, column);
            }
        }
        else {
            renderChildren(context, column);
        }
    }

If the SelectCheckboxMenu is placed standalone in a form, then the helperKey is null, which is correct.
However, when it is included within a p:dataTable that utilizes a p:columnGroup with type="header" for rendering the header, the helperKey is assigned columnGroup. Consequently, the column renderer incorrectly assumes it is rendering the column header of the data table.
Do you have an idea how to fix this issue?

@melloware
Copy link
Member

@ltlBeBoy i have to research this. I just looked and that Helper Renderer code has been in there since 2014!

@melloware
Copy link
Member

OK I figured it out. 2 PR's coming so the team can discuss.

@ltlBeBoy
Copy link
Contributor Author

@melloware I tested the first workaround, and it works like a charm. I feel like a noob that I didn't have that idea.

@melloware
Copy link
Member

Awesome I am just waiting on a response from the team on which solution they want me to implement then i will backport to 13.0.9

melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 25, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 26, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 26, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 26, 2024
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
2 participants