I have a button that should render only one specific panelGroup (parentWrapper). Instead it re-render the whole page. This is the way it is supposed to work:
- The user looks for a excel document and enters the location in the fileupload component
- Then the user selects a Customer using the Autocomplete component
- Then the user clicks on the AddCustomer button. That executes the CustomerInSchedule (autocomplete) and the action editScheduleController.addCustomerRowFromLookAhead(), both are working fine.
When the user clicks the AddCustomer button, the ajax is supposed to render only the :CustomerScheduleForm:parentWrapper. Instead of that the whole page is rendered. That creates issues in other parts of this page. So the question is: Why is ajax rendering the whole page and not just the panelGroup id ="parentWrapper" ?
<div align="center"> <h:panelGroup id="editScreenDiv" layout="block" style="width:1180px"> <h:panelGrid border="0" columns="2" class="SimpleFormBoundedSection SubRegionBox" columnClasses="InputLabel,InputElement" rowClasses="FirstRow,LastRow" headerClass="SectionHead"> <!-- some stuff --> <l:fileUpload id="fileupload" value="#{editScheduleController.customerRateScheduleBean.sourceFile}" onchange="file_onchange()" rendered="#{editScheduleController.customerRateScheduleBean.action != 'editSchedule'}" /> <!-- ... some stuff --> <h:commandButton id="AddCustomer" value="Add" action="#{editScheduleController.addCustomerRowFromLookAhead()}" > </h:commandButton> <p:autoComplete id="CustomerInSchedule" required="false" value="#{editScheduleController.customerNumberAndName}" completeMethod="#{editScheduleController.suggestAuthorizedCustomer}" minQueryLength="3" scrollHeight="250" size="65" maxlength="50" forceSelection="true">
For some reason I could not continue adding the xhtml code here. What follows is the rest of the code that belongs to the same page. I have omitted style attributes from the div and the dataTable.
<f:ajax render=":CustomerScheduleForm:parentWrapper" execute="CustomerInSchedule" onevent="clearCustomerInSchedule()"/>
</p:autoComplete>
<h:panelGroup id ="parentWrapper">
<h:panelGroup id ="wrapper">
<div>
<h:dataTable id="customerTable" value="#{editScheduleController.customerRateScheduleBean.listOfCustomersInSchedule}"
var="customerRow" >
<!-- ...some stuff -->
</h:dataTable>
</div>
</h:panelGroup>
</h:panelGrid>
</h:panelGroup>
<!-- ... some stuff -->