Reputation: 9479
I am using JSF 2 / Primefaces 3.5. I have a datatable which shows a list of data. The first column has a hyperlink and it shows the details of that record. I have a strange problem, if I do sorting the order changes from ascending to descending as expected. However the hyperlink pass the old id before sorting and opens the wrong details.
My code looks as below
Page:-
<p:dataTable id="rejectedRecords" var="institution"
value="#{rejectedBean.institutions}" paginator="true" rows="15"
sortMode="multiple" rowsPerPageTemplate="15,50,100,150,200">
<p:column headerText="#{label.institutionName}"
sortBy="#{institution.firmName}" width="40%"
style="font-size:13px; color:black; text-align:left">
<h:commandLink value="#{institution.firmName}"
action="#{rejectedBean.viewCreditInstitutionAction(institution.institutionId)}"
style="font-size:12px; color:#003399">
</h:commandLink>
</p:column>
<p:column headerText="ID">
<h:outputText value="#{institution.institutionId}" />
</p:column>
</p:dataTable>
JSF Bean:-
public String viewCreditInstitutionAction(long institutionId) {
System.out.println("ID arg :: " + institutionId);
<...more code here...>
return "details";
}
Upvotes: 1
Views: 390
Reputation: 9479
After leaving this issue open for some time.... now we found out that this issue was caused due to the scope of that bean.
Earlier we had it in REQUEST scope its now changed to VIEW scope and this has solved the problem.
Thanks
Upvotes: 3