function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jason.wanjason.wan 

rerender not working for apex:repeat

 

<apex:pageBlock title="Labor Lines" rendered="{!if(TargetRecType=='Usage/Consumption',true,false)}"  id="PageBlock1"> <!-- mode="edit" -->
			<apex:pageBlockButtons style="text-align: left;" location="top">
                <apex:commandButton action="{!AddLaborLine2}" reRender="PageBlock1, PageBlock2" value="Add Labor Line" id="APLbutton" status="LodingStdStatus" />
                <apex:commandButton action="{!DeleteLine}" value="Delete Lines" id="DLbutton" status="LodingStdStatus"/>
            </apex:pageBlockButtons>
           	
            <apex:outputPanel id="PageBlock2">
            <table border="1">
            <tr>
            <th>Add Part</th>
            </tr>
            <apex:repeat value="{!NewWORDPartLine}" var="WOPL1" > 
            	<apex:outputPanel rendered="{!WOPL1.SVMXP__Line_Type__c='Labor'}" >
            	<tr> 
            	<th>LabOp Code</th>
            	<td><apex:inputField value="{!WOPL1.SVMXP__Product__c}"/></td>
            	</tr>
            	</apex:outputPanel>
            </apex:repeat>   
            </table>
            </apex:outputPanel>

 

Initially I can see the list under the <apex:repeat>
When attempting to run the Add Labor Line commandbutton, I expect it to rerender the outputPanel id="PageBlock2".  Instead the list just disappears.   I do see the header <th>Add Part</th> but that is it.   If I just rerender PageBlock2, I end up with the list showing up multiple times of the same data!

 

Any ideas?   

 

SargeSarge

Hi  Jason,

 

   Instead of reRendering two components (one nested in another) on click on "Add Labour Line", place a <apex:outPutPanel> tag  surrounding your pageBlockTable (id="PageBlockTable1") and refresh that outputPanel.

 

  Also an observation I made in reRender functionality - you dont reRender an component that is also having some rules to render. instaed surround the component having render formula with outputPanel. Use reRender on the outputPanel instead.