0

does jsf allow to exclude the child section when rendering its parent?

ex:

<h:panelGroup id="parent">
    <h:panelGroup id="child1">
    </h:panelGroup>
    <h:panelGroup id="child2">
    </h:panelGroup>
</h:panelGroup>

reRender="parent"

I called parent to on reRender. How will I exlcude "child1"? I am thinking that I have 100 child sections and I need to render 1-99. So instead of declaring child1-99 in reRender, I will just exclude child100 in the reRender. Is it possible?

Eleven
  • 339
  • 2
  • 6
  • 20

1 Answers1

1

So instead of declaring child1-99 in reRender, I will just exclude child100 in the reRender. Is it possible?

No. At least not with <a4j:ajax> as you seem to be using, nor with <f:ajax>.

Your best bet is to dynamically compose render client IDs, so you don't need to hardcode all 99. This is easy to generate in a loop if they only differ in a numerical suffix such as child1, child2, child3, etc.

<a4j:ajax ... reRender="#{bean.clientIds}" /> 

In case you actually have PrimeFaces at hands too, make use of PFS to select them by CSS: How do PrimeFaces Selectors as in update="@(.myClass)" work?

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555