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
Ron9Ron9 

Page parameters don't work when using rendered

Hey

Can anyone help me understand why using page parameters don't work when using rendered?

 

I've tried this, which only works if I remove the rendered  property from the outputPanel: 

<apex:page standardController="Parent__c" >
    <apex:pageBlock title="Children for {!Parent__c.name}">
        <apex:form >
            <apex:pageBlockTable value="{!Parent__c.Children__r}" var="child">
                  <apex:column headerValue="Name" >
                      <apex:commandLink rerender="detail"> 
                          {!child.Name}
                          <apex:param name="cid" value="{!child.id}"/>
                      </apex:commandLink>
                  </apex:column>
            </apex:pageBlockTable>
        </apex:form>
    </apex:pageBlock>
    <apex:outputPanel id="detail" rendered="{!$CurrentPage.parameters.cid!=''}">
        <apex:detail subject="{!$CurrentPage.parameters.cid}" relatedList="true" title="false" relatedListHover="true"/>
        ...some other stuff...
     </apex:outputPanel>
</apex:page>

 I hope anyone can help me get a bit wiser, thanks

 

- Ronni

Best Answer chosen by Admin (Salesforce Developers) 
souvik9086souvik9086

You are doing rerender and render in the same panel.

Try this in separate panel

 

<apex:page standardController="Parent__c" >
<apex:pageBlock title="Children for {!Parent__c.name}">
<apex:form >
<apex:pageBlockTable value="{!Parent__c.Children__r}" var="child">
<apex:column headerValue="Name" >
<apex:commandLink rerender="detail">
{!child.Name}
<apex:param name="cid" value="{!child.id}"/>
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="detail">
<apex:outputPanel rendered="{!$CurrentPage.parameters.cid!=''}">
<apex:detail subject="{!$CurrentPage.parameters.cid}" relatedList="true" title="false" relatedListHover="true"/>
...some other stuff...
</apex:outputPanel>
</apex:outputPanel>
</apex:page>

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

All Answers

souvik9086souvik9086

You are doing rerender and render in the same panel.

Try this in separate panel

 

<apex:page standardController="Parent__c" >
<apex:pageBlock title="Children for {!Parent__c.name}">
<apex:form >
<apex:pageBlockTable value="{!Parent__c.Children__r}" var="child">
<apex:column headerValue="Name" >
<apex:commandLink rerender="detail">
{!child.Name}
<apex:param name="cid" value="{!child.id}"/>
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="detail">
<apex:outputPanel rendered="{!$CurrentPage.parameters.cid!=''}">
<apex:detail subject="{!$CurrentPage.parameters.cid}" relatedList="true" title="false" relatedListHover="true"/>
...some other stuff...
</apex:outputPanel>
</apex:outputPanel>
</apex:page>

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

This was selected as the best answer
Ron9Ron9

Thank you @souvik9086, It worked. Guess problem wassen't as general as I thought.