0

I have the following <p:commandLink> placed inside <p:dataList> that is placed inside a <ui:repeat> and then another <ui:repeat>:

<h:form>
    <ui:repeat value="#{myManager.selectedNode.data.children}" var="childdatapanel">
        <p:panel header="#{childdatapanel.key}" collapsed="true">  
            <ui:repeat value="#{childdatapanel.value}" var="childdata">
                <h:panelGrid columns="1"> 
                    <p:dataList value="#{childdata.value}" var="entity" itemType="disc" type="inset">  
                        <p:column>
                            <p:commandLink value="#{entity.label}" action="#{myManager.seeDetails(entity)}" styleClass="entity-label"
                                  onclick='alert("#{entity.label}");'>
                            </p:commandLink>        
                        </p:column>
                    </p:dataList>
                </h:panelGrid>
            </ui:repeat> 
        </p:panel>
    </ui:repeat>
</h:form>

The result of this code displays something like this:

childdatapanel.key1
    entity1.1
    entity1.2
    entity1.3

childdatapanel.key2
    entity2.1
    entity2.2
    entity2.3

childdatapanel.key3
    entity3.1
    entity3.2
    entity3.3

childdatapanel.key4
    entity4.1
    entity4.2
    entity4.3

However, although the value of the <commandLink> is displayed correctly and the alert gets the correct value "onclick", however the object passed to myManager.seeDetails(entity) in incorrect. If I press "entity1.1" or "entity2.1" or "entity3.1", I allways get "entity4.1" and so forth.

Any ideea what am I doing wrong? I'm using primefaces 3.4 and primefaces-mobile 1.0 snapshot.

zzirna
  • 11
  • 4
  • 2
    Nested `` has awkward state saving bugs in older Mojarra versions which exposes symptoms exactly as you're facing now. So I guess you're using Mojarra. Which version? PrimeFaces 3.4 is quite old too, so most likely your Mojarra version is also old. If you can for some reason not upgrade to current version (2.1.29 or 2.2.10), try replacing both ``s by ``, which has state saving done right. Let me know if that solves the problem (you never know with older libraries), then I'll repost it as an answer. – BalusC Apr 30 '15 at 21:50
  • But in newer PrimeFaces versions there is a different statesaving issue since they created their own buggy `UIData` – Kukeltje Apr 30 '15 at 22:08
  • The project was implemented a few years ago, when PrimeFaces 3.4 was quite new. Now I'm in the process of doing some rework on the project and one of the first steps I did was to update my libraries, but for such an old project, that did not work quite as expected. @BalusC, replacing both s by didn't fix the issue. I decided to concentrate more on getting the update to work. Thx! – zzirna May 07 '15 at 15:02

0 Answers0