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
arghhhhharghhhhh 

commandLink with actionSupport to display image within actionStatus

I have a list of values in a pageBlockTable for which when a single column in the table is clicked (this column is displaying commandlinks) a section of the vf page refreshes and several other pageBlockSection are updated via ajax. that is working however, only when I remove the actionsupport... when I include the actionsupport to get the "waiting to complete" gif to show up the entire vf section refreshes and my controller is never called. I've scoured the net and have tried the numerous examples explained on this board to no avail... what am I doing wrong?!

 

Below is my code,. Thanks to all who reply:

 

...<apex:actionStatus id="pleasewait" layout="block">
<apex:facet name="start">
<img src="{!$Resource.AjaxAnimation}" />
</apex:facet> 
</apex:actionStatus>
<!-- List of Financial Accounts --> 
<apex:outputPanel id="finAccounts" layout="block" style="overflow:auto; height:250px;"> 
<apex:pageBlock >



<apex:pageBlockSection showHeader="true" title="Financial Accounts List" columns="1"> 
<apex:pageBlockTable value="{!FinAccts}" var="finAcct" id="finAccountsTable" rowClasses="odd,even" styleClass="tableClass"> 

<apex:column >
<apex:facet name="header">Address</apex:facet>
<apex:actionRegion >
<apex:commandlink value="{!finAcct.address}" action="{!getFinAcctDetails}" reRender="acctDetails, acctTransactions"> 
<apex:actionSupport event="onclick" status="pleasewait" /> 
</apex:commandlink>
</apex:actionRegion> 
</apex:column> 
<apex:column >
<apex:facet name="header">City</apex:facet> 
<apex:outputText value="{!finAcct.city}"/> 
</apex:column>

<apex:column >
<apex:facet name="header">State</apex:facet> 
<apex:outputText value="{!finAcct.state}"/>
</apex:column>

<apex:column >
<apex:facet name="header">Postal</apex:facet> 
<apex:outputText value="{!finAcct.zip}"/>
</apex:column>

<apex:column >
<apex:facet name="header">Country</apex:facet> 
<apex:outputText value="{!finAcct.country}"/>
</apex:column>
</apex:pageBlockTable> 
</apex:pageBlockSection> 
</apex:pageBlock> 
</apex:outputPanel>...
Best Answer chosen by Admin (Salesforce Developers) 
bvramkumarbvramkumar

Two reasons.

 

1. You have not included rerender attribute in your actionsupport that is the reason your entire VF page refreshes. It is a best practice use rerender attribute in components like commandbutton, actionfunction and actionsupport etc. ... in case you want to perform some action in controller and stay on the same page after refreshing( also called rerendering) one or more parts of the VF page.

 

2. Command link has the submit behaviour by default. you do not need an actionsupport again. "Status" attribute is there on commandlink too. You do not need action support again.

 

Precisely.. you just need to do the below:

 

<apex:commandlink value="{!finAcct.address}" action="{!getFinAcctDetails}" reRender="acctDetails, acctTransactions" status="pleasewait"> 
</apex:commandlink>

All Answers

Rahul SharmaRahul Sharma

Hi arghhhhh,

 

Check if you are able to access the image src i.e. path is proper or not.. Check for any JS error too.

Also try putting the img inside a div.

bvramkumarbvramkumar

Two reasons.

 

1. You have not included rerender attribute in your actionsupport that is the reason your entire VF page refreshes. It is a best practice use rerender attribute in components like commandbutton, actionfunction and actionsupport etc. ... in case you want to perform some action in controller and stay on the same page after refreshing( also called rerendering) one or more parts of the VF page.

 

2. Command link has the submit behaviour by default. you do not need an actionsupport again. "Status" attribute is there on commandlink too. You do not need action support again.

 

Precisely.. you just need to do the below:

 

<apex:commandlink value="{!finAcct.address}" action="{!getFinAcctDetails}" reRender="acctDetails, acctTransactions" status="pleasewait"> 
</apex:commandlink>
This was selected as the best answer
Rahul SharmaRahul Sharma

Good catch bvramkumar. :)

arghhhhharghhhhh

Thanks guys, adding the rerender and status to the commandLInk worked.  What's funny is I had already tried that before but with no luck but when coding through the night any number of errors could have happend while doing so :)

 

thanks again for all your help :)