I just duplicated this behavior in my JSF/PrimeFaces web app. One of the endusers mentioned this to me earlier, but I could not see her screen/monitor, and I had no idea what she was talking about. Talk about the need to regression test after migrating from PrimeFaces p:layout to PrimeFaces extensions pe:layout.
In the screen capture above, that is how the page renders AFTER p:autoComplete's p:ajax update="@(.ui-panel) ...".
Code: Select all
<ui:composition>
<p:panel header="Customer">
<h:panelGroup>
<p:autoComplete id="customerId" value="#{pf_ordersController.selectedCustomer}"
completeMethod="#{pf_customerController.complete}" var="c"
itemLabel="#{c.customerName}" itemValue="#{c}"
maxResults="10" queryDelay="300" size="50" onblur="close()">
<p:ajax partialSubmit="false" event="itemSelect" global="false"
onstart="displayLoadingImage(true)" oncomplete="displayLoadingImage(false)"
update="@(.ui-panel) :orderEditForm:formMessages :orderEditForm:_ajax_status"/>
<f:facet name="itemtip">
<h:panelGrid columns="2" cellpadding="3">
<f:facet name="header">
<h:outputText value="#{c.customerName}" />
</f:facet>
<h:outputText value="Number:" />
<h:outputText value="#{c.customerId}" />
<h:outputText value="Leader:" />
<h:outputText value="#{c.leaderPointOfContactId ne null ? c.leaderPointOfContactId.pointOfContactName : ''}"/>
</h:panelGrid>
</f:facet>
</p:autoComplete>
<p:commandButton value="Select" icon="ui-icon-search"
actionListener="#{pf_ordersController.setPageEditCustomer(pf_customerController.prepareSelectCustomerForOrder())}"
update="@(.ui-panel) :orderEditForm:formMessages :orderEditForm:_ajax_status">
</p:commandButton>
</h:panelGroup>
</p:panel>
The strange thing is... this behavior does not happen for the p:commandButton that you see in the code above. It only occurs on the p:autoComplete p:ajax. Both update="..." (for p:ajax and p:commandButton) have the same update="...". See that?
The p:commandButton displays a dataTable at bottom of screen, allowing user to use a dataTable to select a 'new' (or another) customer instead of using the p:autoComplete to select a new/another customer.
Also, this behavior is not duplicated when user clicks Select button, after selecting a new customer via the datatable, and the original view is restored afterwards.