Based on this topic i have searched a lot, after trying all the suggestions i couldn't find solution to my problem. So only i am posting this.
I have a datatable -> column -> commandlink.
When i click the commandlink, the backend bean has to invoke and update the values of the bean and same to be update in the datatable.
Whenever i am clicking the commandlink on the first page(pagination), the call is invoking. If i click on other pages(other than 1st page), it doesn't invoke the backend bean rather it redirects to the 1st page of the datatable.
I have tried many solutions like ajax=false or true, process="@this", action or actionListener, kept bean in ViewScope or SessionScope.
Environment:
IBM WebSphere Portal 8.5
Following is the code, please help to suggest the solution.
Code: Select all
<!-- jsf:pagecode language="java" location="/src/pagecode/CommandLinkTestView.java" --><!--/jsf:pagecode -->
<div xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:portlet="http://java.sun.com/portlet_2_0"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:form>
<div class="ui-fluid">
<div class="ui-g">
<div class="ui-g-12 ui-lg-12 ui-md-12".
<h4>Data Table</h4>
<p:dataTable id="consultanttable" var="consultant" value="#{commandLinkTestBean.consultants}" widgetVar="filteredConsultant" paginator="true" rows="5" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,15" reflow="true" styleClass="porDataTable">
<f:facet name="header">
List of Consultants
</f:facet>
<p:column headerText="Id" style="text-align: center;">
<h:outputText value="#{consultant.id}"></h:outputText>
</p:column>
<p:column headerText="Type" style="text-align: center;">
<h:outputText value="#{consultant.assessmentType}"></h:outputText>
</p:column>
<p:column headerText="Stage" style="text-align: center;">
<h:outputText value="#{consultant.stage}"></h:outputText>
</p:column>
<p:column headerText="Temp Title" style="text-align: center;">
<h:outputText value="#{consultant.tempTitle}"></h:outputText>
</p:column>
<p:column headerText="Updated By" style="text-align: center;">
<h:outputText value="#{consultant.updatedBy}"></h:outputText>
</p:column>
<p:column headerText="Updated On" style="text-align: center;">
<h:outputText value="#{consultant.dateUpdated}">
<f:convertDateTime pattern="dd/MM/yyyy"></f:convertDateTime>
</h:outputText>
</p:column>
<p:column headerText="Status" style="text-align: center;">
<p:commandLink action="#{commandLinkTestBean.commandLinkCheck}" value="Status">
</p:commandLink>
</p:column>
<p:dataTable>
</div>
</div>
</div>
</h:form>
</h:body>
</div>