• Lizzie W
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
This is a sample. When I click 'hide it', it supposed to hide the text, but nothing happened. Could some one help?

/***************Page**********************/

<apex:page sidebar="false" showChat="false" showHeader="false" controller="TestRenderCtrl">
    <apex:form >
        <apex:outputPanel id="panel1"  rendered="{!isRendered}">
            Panel: it is used for testing render.
        </apex:outputPanel>
        <apex:outputPanel >
            <apex:commandButton value="hide it" action="{!hidePanel}" reRender="panel1" />  
            <apex:commandButton value="show it" action="{!showPanel}" reRender="panel1" />
        </apex:outputPanel>
    </apex:form> 
</apex:page>

/***************Controller*****************/

public class TestRenderCtrl{
  
    public Boolean isRendered {get; set;}
      
    public TestRenderCtrl(){
        isRendered = true;
    }
  
    public PageReference hidePanel(){
        isRendered = false;
        return null;
    }
  
    public PageReference showPanel(){
        isRendered = true;
        return null;
    }
}
This is a sample. When I click 'hide it', it supposed to hide the text, but nothing happened. Could some one help?

/***************Page**********************/

<apex:page sidebar="false" showChat="false" showHeader="false" controller="TestRenderCtrl">
    <apex:form >
        <apex:outputPanel id="panel1"  rendered="{!isRendered}">
            Panel: it is used for testing render.
        </apex:outputPanel>
        <apex:outputPanel >
            <apex:commandButton value="hide it" action="{!hidePanel}" reRender="panel1" />  
            <apex:commandButton value="show it" action="{!showPanel}" reRender="panel1" />
        </apex:outputPanel>
    </apex:form> 
</apex:page>

/***************Controller*****************/

public class TestRenderCtrl{
  
    public Boolean isRendered {get; set;}
      
    public TestRenderCtrl(){
        isRendered = true;
    }
  
    public PageReference hidePanel(){
        isRendered = false;
        return null;
    }
  
    public PageReference showPanel(){
        isRendered = true;
        return null;
    }
}