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
benito camelabenito camela 

render component when onLoad

Hi,

Currenty I have defined some content inside a Visualforce Component.

This Component is seen only when the user clicks a button.

I would like to load this Component when page finish the load or the user clicks on the button.

I thought set a boolean var in the constructor to false (shouldLoadTheComponent)

Set rendered = shouldLoadTheComponent in the component and onLoad, call an actionFunction that would set shouldLoadTheComponent = true and then rerender the component.

What do you think?

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,


You can do in this way also like create a function and call that inside the apex:page action component.Like below:
<apex:page action=”{!show}” controller=”Test”>
</apex:page>
Public class Test
{
Public Boolean shouldLoadTheComponent{get;set;}
Public test()
{
shouldLoadTheComponent=false;
}
Public void show()
{
shouldLoadTheComponent=true;
}
}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.