I've read a lot of posts to try and solve my problem but none could help me... So here I am Asking if someone can tell me if I'm doing something wrong:
I have a JSF Composite Component A which I pass a custom attribute value with the ID of another composite component B. Whenever I change something on Component A, Component B should be re-rendered with a4j:ajax function.
This works perfectly.
But, now I need Component B to be initially rendered with an EL expression that depends on some managed bean MB as follows:
<mycomp:B id="comp-b" rendered="#{MB.value gt 0}">
On MB's constructor, values is set to 0. As expected, on first access to page, Component B is not rendered.
Problem:
When selecting some value on component A, it changes MB.value and triggers the ajax valueChange event but the component B won't show up. If I refresh the page or click enter on the Url bar, component B shows up.
I cannot post my actual code here but I will try to show the actual behaviour:
Page.xhtml
<h:form>
<mycomp:A id="comp-a" changeListener="#{MB.listener}" renderComps="comp-b" />
<mycomp:B id="comp-b" rendered="#{MB.value gt 0}" />
</h:form>
compA.xhtml
<cc:interface>
<cc:attribute name="renderComps" />
<cc:attribute name="listener" method-signature="void m(javax.faces.event.ValueChangeEvent)" />
</cc:interface>
<cc:implementation>
<h:outputLabel value="Comp A: " />
<myComp:select listener="#{cc.attrs.listener}"
render="#{cc.attrs.renderComps}"
/>
</cc:implementation>
compB.xhtml
<cc:interface>
</cc:interface>
<cc:implementation>
<span id="cc.clientId">
<h:outputLabel value="Comp B" />
</span>
</cc:implementation>
I appreciate your help!