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

accordion: expanded-panels not working #873

Closed
kgeis opened this issue Sep 25, 2017 · 6 comments
Closed

accordion: expanded-panels not working #873

kgeis opened this issue Sep 25, 2017 · 6 comments
Assignees
Milestone

Comments

@kgeis
Copy link

kgeis commented Sep 25, 2017

I am using BootsFaces 1.1.3 with PrimeFaces 6.1. I create an accordion with panels, and I set the expanded-panels attribute on the accordion. The corresponding panel always loads collapsed.

Example:

<b:accordion expanded-panels="panel2">
    <b:panel id="panel2" title="Panel 2">
    </b:panel>
</b:accordion>
@kvj2020
Copy link

kvj2020 commented Sep 29, 2017

I have encountered this same issue in 1.2.0 Snapshot. I am not using PrimeFaces. I believe the issue only occurs when the accordion is wrapped inside an h:form. If the form is removed the expansion works properly.

@TheCoder4eu TheCoder4eu self-assigned this Oct 1, 2017
@TheCoder4eu
Copy link
Owner

@kgeis did you try what @kvj2020 suggested?

@kgeis
Copy link
Author

kgeis commented Oct 2, 2017

@TheCoder4eu, no, I did not try @kvj2020's suggestion. That would probably make the accordion work, but it would make my form not work...

@kvj2020
Copy link

kvj2020 commented Oct 2, 2017

I think a valid scenario is to allow accordions inside a form. I was commenting on what was causing the issue rather than identifying a work around. I would like to use the accordion inside a form. For a b:panel with an id='panel1' inside a form, the clientId is similar to 'j_id_s_1:panel1'. When the accordion is not inside a panel the clientId is 'panel1'.

Although I do not know the framework well enough, here are two options

  1. In both cases the id is 'panel1'. Change AccordionRender.encodingBegin(...) line 104
    from: if (null != expandedIds && expandedIds.contains(_childPane.getClientId()))
    to: if (null != expandedIds && expandedIds.contains(_childPane.getId()) ?

  2. if clientId contains ':' split it and use the second item from the split for the above contains check

@TheCoder4eu
Copy link
Owner

@kvj2020 thanks for the suggested code (option 2) I just applied it and committed.

@vsvetoslavov
Copy link
Contributor

vsvetoslavov commented Jan 19, 2021

This issue is still reproducible in v1.4.2 - apparently expandedPanels/expanded-panels must contain client ids

@geopossachs geopossachs self-assigned this Jan 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants