Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am tying to hide and show apex:pageblocker on the bases of the value in list. But i am not able to show when value is not been selected. My anybody tell me what is wrong. I am getting value in the pageblockTable.

my code:

     <apex:commandButton action="{!addSelected}" value="Add Selected" reRender="id_ViewSelectedItem"/>

     <apex:pageBlock title="Selected Installed Items" id="id_ViewSelectedItem"  rendered="{!IF(theInstalledItem_checkedView.size>0, true, false)}">
     <apex:pageBlockTable value="{!theInstalledItem_checkedView}" var="ins" >
share|improve this question
I tried in this way also rendered="{!theInstalledItem_checkedView != null || theInstalledItem_checkedView.size>0}" – AnuRaj Jan 22 '13 at 11:29
What is the problem? What you can not to show? – Sergey Utko Jan 22 '13 at 11:54

It seems to be related to the use of 'reRender' on your commandButton. I am not 100% why, the docs don't seem to indicate any restrictions around targeting components in a rerender that then use the rendered attribute. So this could be a VF bug. Anyway here are a couple of ways to get this to work as your expecting...

  • If you remove the 'reRender' attribute it works
  • If you add an outer panel wrapping the page block section it works.

My test code (slightly adapted from your sample) below, reflects the second option above.

<apex:page controller="HideAndShowController">
        <apex:commandButton action="{!addItem}" value="Add Item"
            reRender="outerPanel" />
        <apex:outputPanel id="outerPanel">
            <apex:pageBlock title="Selected Installed Items"
                rendered="{!IF(myList.size > 0, true, false)}">
                <apex:pageBlockTable value="{!myList}" var="ins">
                    <apex:column value="{!ins}" />

Update: This blog from Bob Buzzard offers further insight into this issue. Nice one Bob!

share|improve this answer
Interesting article. I always assumed it was something to do with the fact that because the reRender action only re renders the element's children, excluding itself (which I found made some kind of sense to me) – Ben Jan 22 '13 at 17:07
How to do it without outputPanel? – Vivek Malpani Apr 27 '15 at 12:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.