There seems to be a problem with the rendering order between a DataTable and the rest of the components.
Here is my situation: I have a form which encloses several components which are needed for the search and a datatable component with a custom data model. There is a command link which should trigger the query via a custom method in the backing bean something like this
The scope of the bean connected to the input fields is longer than request (if you look into the attached fields it might look weird, but I have handled them by a transparent query history cache which has session scope and a limited size)
<h:inputText id="search1" size="40" value="#{mybeanwithasessionscoe.property}" />
<h:commandLink id="search" action="#{backingBean.startSearch}"> <h:outputText value="[Search]"/>
</h:commandLink>
The table which is below the search area within the same form is a standard datatable with a custom datamodel and a connected data scroller... (see the attached files)
The problem I run into is, that the search is triggered, but at the moment the search method is called the first time the values are not set in the bean which is connected to the input fields.
Then the table is rendered, thus it uses the old values, then
the method of the commandLink is called a second time, but this
time the values are transferred into the bean which keeps the search values.
The problem with this is, that the table is rendered way before the values are transferred into the bean which is also used by the table model to filter the datasets. Thus the rendering of the table
is usually one click behind the input of the fields.
Is this a bug, or do I miss something here?
immediate true or false in the command link unfortunately does not make any difference, and my search field history works as expected, i was able to check that in the debugger via the object ids, it was giving back.
<%@ page session="false" contentType="text/html;charset=utf-8"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://myfaces.sourceforge.net/tld/myfaces_ext_0_9.tld" prefix="x"%>
<h:panelGroup id="mymaster" > <x:dataTable id="zdata2" value="#{testBean.dataModel}" var="bean" preserveDataModel="false" styleClass="scrollerTable" headerClass="standardTable_Header" footerClass="standardTable_Header" rowClasses="standardTable_Row1,standardTable_Row2" columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column,standardTable_Column,standardTable_Column" rows="10" > <h:column> <f:facet name="header"> <h:panelGroup> <h:commandLink actionListener="#{testBean.sort}" immediate="false"> <f:param name="sortValue" value="id" /> <h:outputText value="ID" /> </h:commandLink> </h:panelGroup> </f:facet> <h:outputText value="#{bean.id}" /> </h:column> <h:column> <f:facet name="header"> <h:commandLink actionListener="#{testBean.sort}" immediate="false"> <f:param name="sortValue" value="vname" /> <h:outputText value="VORNAME" /> </h:commandLink> </f:facet> <h:outputText value="#{bean.vname}" /> </h:column> <h:column> <f:facet name="header"> <h:panelGroup> <h:commandLink actionListener="#{testBean.sort}" immediate="false"> <f:param name="sortValue" value="nname" /> <h:outputText value="NACHNAME" /> </h:commandLink> </h:panelGroup> </f:facet> <h:outputText value="#{bean.nname}" /> </h:column> <jsp:include page="stdcolumnop.jsp" /> </x:dataTable> <jsp:include page="datascroller.jsp" /> </h:panelGroup>
<%@ page import="java.math.BigDecimal, java.util.Date, forms.TestClassDetail "%> <%@ page session="false" contentType="text/html;charset=utf-8"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <html> <body> <f:view> <h:panelGroup id="body"> <h:messages id="messageList" showSummary="true" showDetail="false" /> <h:inputHidden id="hidden" value="#{testBean.pagePos}" /> <h:form id="mainForm"> <f:subview id="createForm"> <h:panelGrid columns="2" id="queryFields"> <h:outputLabel for="searchvname" value="Vorname" /> <h:inputText id="searchvname" size="40" value="#{testBean.query.delegate.vname}" > <f:validateLength minimum="3" maximum="20" /> </h:inputText> <h:outputLabel for="searchnname" value="Nachname" /> <h:inputText id="searchnname" size="40" value="#{testBean.query.delegate.nname}" /> <h:commandLink id="search" action="#{testBean.query.startQuery}" rendered="true" > <h:outputText value="[Suchen]" /> </h:commandLink> <h:commandLink id="searchclar" action="#{testBean.query.resetQuery}" rendered="true"> <h:outputText value="[Zuruecksetzen]" /> </h:commandLink> </h:panelGrid> </f:subview> <h:inputHidden id="pagePos" value="#{testBean.pagePos}" /> <f:subview id="masterTable"> <jsp:include page="inc/testingMasterTableModel.jsp" /> </f:subview> <f:verbatim> <br> </f:verbatim> <h:panelGroup id="setOperations"> <h:commandLink id="createEntry" action="gocreate" rendered="true"> <h:outputText value="[Neuen Eintrag anlegen]" /> </h:commandLink> <h:commandLink id="deleteAllData" action="godeleteall" rendered="true"> <h:outputText value="[Ausgewaehlte Datensaetze loeschen]" /> </h:commandLink> </h:panelGroup> </h:form> </h:panelGroup> </f:view> </body> </html>