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
AMSAMS 

Rerender fails if pageBlock includes the "rendered" attribute

I'm working on extending the Sorting Tables example from the wiki: http://wiki.developerforce.com/index.php/Sorting_Tables

 

I'd like the user to be able to enter some filter criteria and then see a sortable table of the results. One of the filter criteria is a checkbox for "Include Details." If this box is checked, the user should get a sortable table; if not, just some summary data. 

 

The problem that I'm running into is that adding a rendered="{!includeDetails}" attribute to the details pageBlock breaks my sorting action --- clicking on a column heading no longer does anything. Without the rendered attribute, both doFilter and doSort work correctly; with the rendered attribute, doFilter works and outputs a table, but it isn't sortable.

 

 

<apex:page controller="forecastClass" tabstyle="Opportunity" sidebar="false"> <apex:form > <apex:pageBlock title="Filter Criteria"> <table cellpadding = "4" cellspacing = "4"> <tr> <td><label><b>Site: </b></label></td> <td><label><b>Start Date: </b></label></td> <td><label><b>End Date: </b></label></td> <td><label><b>Include details? </b></label></td> <td></td> </tr> <tr> <td><apex:inputField value="{!filterOp.Site__c}"/></td> <td><apex:inputField id="StartDate" value="{!filterOp.CloseDate}" /></td> <td><apex:inputField id="EndDate" value="{!filterOp.Confirmation_Date__c}" /></td> <td align="center"><apex:inputField id="IncDetails" value="{!filterOp.Anonymous_gift__c}" /></td> <td><apex:commandButton value="Go" action="{!doFilter}" rerender="container"></apex:commandButton></td> </tr> </table> </apex:pageBlock> </apex:form> <apex:outputPanel id="container"> <apex:pageBlock id="opDetails" title="Opportunity Details" rendered="{!includeDetails}"> <!-- remove rendered attrib for sorting --> <apex:form > <apex:pageBlockTable value="{!opps}" var="o" id="table"> <apex:column > <apex:facet name="header"> <apex:commandLink value="{!$ObjectType.Opportunity.Fields.Name.Label}" action="{!doSort}" rerender="table"> <apex:param name="sortField" value="Name" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputLink value="/{!o.id}">{!o.name}</apex:outputLink> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="{!$ObjectType.Opportunity.Fields.StageName.Label}" action="{!doSort}" rerender="table"> <apex:param name="sortField" value="StageName" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.StageName}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="%" action="{!doSort}" rerender="table"> <apex:param name="sortField" value="Probability" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.Probability}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="{!$ObjectType.Opportunity.Fields.CloseDate.Label}" action="{!doSort}" rerender="table"> <apex:param name="sortField" value="CloseDate" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.CloseDate}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="{!$ObjectType.Opportunity.Fields.Amount.Label}" action="{!doSort}" rerender="table"> <apex:param name="sortField" value="Amount" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.Amount}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Revenue" action="{!doSort}" rerender="table"> <apex:param name="sortField" value="Time_Restriction__c" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.Time_Restriction__c}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Type" action="{!doSort}" rerender="table"> <apex:param name="sortField" value="Type" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.Type}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Owner" action="{!doSort}" rerender="table"> <apex:param name="sortField" value="OwnerId" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.OwnerId}"/> </apex:column> </apex:pageBlockTable> </apex:form> </apex:pageBlock> <!-- opDetails --> </apex:outputPanel> <!-- container --> </apex:page>

 

 

reatlimecoreatlimeco

Did you ever get answer on this from Salesforce?

 

Is this a known bug?

AMSAMS

Yes, it appears this behavior is normal. I was able to resolve the issue by wrapping the section in an extra outputPanel for the rerender. See this other thread for more details:

 

http://community.salesforce.com/sforce/board/message?message.uid=133929