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
SidharthSidharth 

Component Rerendering

Hello Everyone

 

I have 2 apex components (google charts), in my Client portal, one showing Active and other Resolved accounts.

 

I want to show ony one component at a time. Can i rerender the component area, by clicking any button/link.

 

Thanks

Sid

Best Answer chosen by Admin (Salesforce Developers) 

All Answers

Shashikant SharmaShashikant Sharma

yes you can use redered attribute , just share your code so thayou t I can give exact code.

SidharthSidharth

Hi Shashikant

 

Thanks for replying back.

Hers the code for component 1. Component 2 is just similar(just extracting different values from the controller). 

</apex:component>

 

Right now i am showing both components in my client portal, but now i have to provide two buttons/link, one for Active accounts, another for Resolved accounts, and only one component based on the button/link. Whichever a person clicks, that graph will rerender.

 

Thanks

Sid

 

 

 

 

<apex:component controller="TestChartController2"> 
<div class="yourdebtsPanel" id="debtSettled"> 
    <div class="panelHeader"> 
        <h1>Your Debts</h1> 

    </div> 
    <div class="panelContent150"> 
      
       <img src="https://fdrclient.com/proxy-1.0/proxy?proxiedUrl=http%3A%2F%2Fchart.apis.google.com%2Fchart&cht=bvo&chdl={!chart.chdl}&chdlp=b|{!chart.chdlp}&chs=550x280&chd=t2:{!chart.chd}&chco=E0E0E0,{!chart.chco},153E7E&chbh={!chart.chbh}&chxr=0,0,{!chart.chxr}&chxt=y&chds=0,{!chart.chds}&chxs=0,N*cUSD&chm={!chart.chm}|h,C0C0C0,0,0:1:.1,1,-1"/>
        
    </div> 
        <div class="panelFooter"></div>
    </div>  
Shashikant SharmaShashikant Sharma

Create a Property  in Page controller 

 

public Boolean showComponent1{get;set;}

 

set this to true if  account is Active and false if it is resolved



In VFP 

you must be using component in page like below , use rendered attribute

 

<c:Component1Name      rendered="{!showComponent1}" />
<c:Component2Name      rendered="{!NOT(showComponent1)}" />

let me know if any issues in it.

SidharthSidharth

Hi 

Thanks for reply.

 

heres exactly what i need.

 

I have two components A and B, which i am showing in my Client portal.

Right now i am showing both, but now i have to show only one. 

Can i have two buttons/links naming A and B, so by clicking on any one, that component with open.

 

Here is Component A code, (B is just similar with different google chart partameters).

 

<apex:component controller="TestChartController2a"> 
   <div>              

<img src="https://fdrclient.com/proxy-1.0/proxyproxiedUrl=http%3A%2F%2Fchart.apis.google.com}"/>           

</div> 
</apex:component>

 

Here is Visualforce page where i am caaling the components.

 

<apex:page showHeader="false" sidebar="false" standardController="Account">   

<apex:stylesheet value="{!$Resource.CustomerPortalCSS}"/>       

<div>       

<table>           

<tr>               

<td><c:Component_A /></td>               

<td><c:Component_B /></td>              

          </tr>       

</table>   

</div>

</apex:page>

 

Actually i have many other division in my customer portal, so i want to rerender only that componet division, based on selected button/link (component A or B)

Please provide a sample code to achieve that, if possible.

 

Thanks a lot

Shashikant SharmaShashikant Sharma

try this 

<apex:page showHeader="false" sidebar="false" standardController="Account">   
<apex:stylesheet value="{!$Resource.CustomerPortalCSS}"/>       
<div>       
<table>           
<tr>               
<td><c:Component_A rendered="{!IF(Account.Status__C = 'Active' , true , false)}"/></td>               
<td><c:Component_B rendered="{!IF(Account.Status__C = 'Resolved' , true , false)}"/></td>              
          </tr>       
</table>   
</div>
</apex:page>

 

I have used Status__c as Assuming this your field API name , replace it with yours.

 

If it does not work please let me know : Active and Resolved for Account are coming from which field can you provide me field type and API Name

SidharthSidharth

The problem , how can i link them to the button/links. So that is the user select button A, the division should show Copmnent A

 

Here is the actual scenario.

 

For ex, if client has 25 accounts. Than instead of showing all 25 accounts in 1 component, i want 5 components, each showing 5 accounts(google chart bars).

For that i am assuming to have 5 buttons/links(kind of pagination), where a user can select any set of 5 accounts, and than that component will be displayed.

sean*harrisonsean*harrison

Sidharth, There's a section in the VF docs entitled, "Implementing Partial Page Updates with Command Links and Buttons." Does that get you what you need? If not, what's missing?

SidharthSidharth
This was selected as the best answer