I'm trying to rendered a commandLink base on a variable inside the controller.

When I use the rendred like below, its everytime get "false" value, and I cant see it (rendered=false)

My variable's name inside the controller is : "showProdTables".

<apex:commandLink id="addtotableId" action="{!addToTable}" value="{!srt}" oncomplete="doneAdding();"  rendered="{!showProdTables}" />

but If I use the same variable in the value attribute like below and remove the rendered attribute:

<apex:commandLink id="addtotableId" action="{!addToTable}" value="{!showProdTables}" oncomplete="doneAdding();" />

I can see it turn to true when it needs to be and false otherwise.

I making an actionsupport to call the controller - and I Rerender the commanLink's Id there :

<apex:selectList value="{!productItemSelected}" id="selectedProductItemListId">
  <apex:selectOptions value="{!prdt222}" id="selectOptionsProductItemId"/>
   <apex:actionSupport action="{!checkProductPrice}" event="onchange" reRender="quantity,pricing,comments,addtotableId" />


What am I missing here?

BTW - I rendered other sections with this variable ("showProdTables") and it working fine. I tried to wrap it with outputPanel but it's not working either.


Something that helped me : (although I don't like solution of this kind) I wrapped it with double output panels one is the Id and one is the rendered one.

   <apex:outputPanel id="addtotableId">
       <apex:outputPanel rendered="{!showProdTables}" >
         <apex:commandLink action="{!addToTable}" value="customLabel" reRender="addtotableId" oncomplete="doneAdding();" />

1 Answer 1


This can sometimes be an issue with complicated layouts. What I generally do is wrap the rendered element with an element that can be reRendered.

  • Hi @sfdfox, unfortunately, this solution did not help me. I used your tip to wrap it with something that can be ReRender so if you can just remove the solution itself and just write your tip, I will give you the best answer. BTW - I updated the question with something that did work - not sure why I need to do it like that - I would like for some explanation if you have. Thanks!
    – Salvation
    Apr 16, 2019 at 13:57
  • @Salvation Interesting. Maybe it's something to do with apex:commandLink. I don't really have time to explore it right now, but as long as you have a solution, that should be okay.
    – sfdcfox
    Apr 16, 2019 at 14:32
  • Thanks a lot. if you can, just delete the code example from your answer and I'll give you the best answer - because using the wrap solution directed me to my solution. Thanks!
    – Salvation
    Apr 16, 2019 at 14:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .