You need to sign in to do that
Don't have an account?
V Anand
How to rerender apex:outputlink
HI...
I have created a component .It contains some outputlinks like......
<apex:outputlink value="/apex/Home" ><font color="white" size="4">Home</font></apex:outputlink>
Now I want to rerender the above link ,and I am using this component in template .How can I rerender the apex/home page...
Is there any other way to implement this Please suggest me?
Thanks in advance
Wrap your output link in a apex:outputpanel and then use something (a button for example) and have it re-render that output panel.
Here is some pseudo code to get you started:
@colemab gave you the correct solution. However I would like to say we can change one small thing here. For rerendering an Outputlink, it is not necessary to wrap it in an Outputpanel, you can directly use it's id for rerendering.
Example:
<apex:outputLink value="/{!loginLogout}" id="ol">{!loginLogout}</apex:outputLink>
<apex:commandButton value="rerenderLink" action="{!linkRerender}" rerender="ol"/>
Here, the commandButton click will still rerender the outputLink without using a container (outputPanel) for it. :)
Thank your for your reply......
what action I can use for <apex:commandbutton action ={!mymethod}>
By action, are you referring to the action attribute in apex:commandButton?
It is a controller method where you write your logic that should be executed on click of the button.
<apex:commandButton value="Go" action="{!searchResults}"/>
For the above example,
you need to have a method like this in your controller:
public void searchResults()
{
// some piece of code
}
@vishal@force you can re-render outputlink directly. However, in real word implmentations you will often want to refresh more than just the link upon the command button being pushed. You *can* use a comma delimited list of ids to rerender but then you have to maintain it.
For these reasons, it is often quicker and low maintaince to wrap 'sections' of your page in output links and re-render those whole sections as opposed to a list of individual id's. The exception may be on *very* large visualforce pages, where for performance reasons you may have to re-render just the updated items.
In the end though, either way works. Kind of like 1+3 =4 vs 2+2=4.