You need to sign in to do that
Don't have an account?
VarunC
Show / Hide pageblock on button click
Hi,
I'm trying to show or hide a PageBlock on click of a commandbutton.
here is what i'm trying to do:
Button Code:
My Page Code:
"selectedContacts" is populated with Selected Contacts on CommandButton click. But the Page Block (pageBlockProcessed) does not show or hide when i populate and hide data in "selectedContacts" :(.
My Full page layout is something like this:
The code in RED above needs to Be Shown and Hidden on click of "Process Selected" button.
CAN ANYONE help me here ? ... plz ...
At this point the page BLOCK is displaying At All times, selectedContacts is able to only hide the pageBlockTable, as and when there is data in the list. But i want FULL page block to Show and Hide with presence of data in selectedContacts.
- Varun
I'm trying to show or hide a PageBlock on click of a commandbutton.
here is what i'm trying to do:
Button Code:
Code:
<apex:commandButton action="{!processSelected}" value="Process Selected" reRender="pageBlock, pageBlockProcessed" status="AjaxStatus"></apex:commandButton>
My Page Code:
Code:
<apex:pageBlock title="Selected Records" id="pageBlockProcessed"> <apex:pageMessages ></apex:pageMessages> <apex:pageBlockTable value="{!selectedContacts}" var="l" rendered="{!NOT(ISNULL(selectedContacts))}"> <apex:column value="{!l.Name}"></apex:column> <apex:column value="{!l.Email}"></apex:column> <apex:column value="{!l.Phone}"></apex:column> </apex:pageBlockTable> </apex:pageBlock>
"selectedContacts" is populated with Selected Contacts on CommandButton click. But the Page Block (pageBlockProcessed) does not show or hide when i populate and hide data in "selectedContacts" :(.
My Full page layout is something like this:
Code:
<apex:page controller="Contacts">
<apex:sectionHeader title="Contact List"></apex:sectionHeader>
<apex:form >
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlock title="" id="pageBlockFilter">
... Some VF Code ...
<apex:commandButton action="{!processSelected}" value="Process Selected" reRender="pageBlock, pageBlockProcessed" status="AjaxStatus"></apex:commandButton>
</apex:pageBlock>
<br/>
<div style="width:100%;display:{!IF(ISNULL(selectedContacts),'block','none')}">
<apex:pageBlock title="Selected Records" id="pageBlockProcessed">
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlockTable value="{!selectedContacts}" var="l" rendered="{!NOT(ISNULL(selectedContacts))}">
<apex:column value="{!l.Name}"></apex:column>
<apex:column value="{!l.Email}"></apex:column>
<apex:column value="{!l.Phone}"></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</div>
<apex:pageBlock title="" id="pageBlock">
<apex:pageBlockTable value="{!contacts}" var="c" rendered="{!NOT(ISNULL(contacts))}" rows="{!pageSize}">
... Some VF Code ...
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
CAN ANYONE help me here ? ... plz ...
At this point the page BLOCK is displaying At All times, selectedContacts is able to only hide the pageBlockTable, as and when there is data in the list. But i want FULL page block to Show and Hide with presence of data in selectedContacts.
- Varun
Something like this:
Does that help?
it worked like a charm now .. with outputPanel and that Rendered variable fix ... :D ...
Thanks again .. I was upto this issue for around 2 days .... i think I still miss many-many of the VF tags to learn :)