You need to sign in to do that
Don't have an account?
Shree K
Need help..PageBlock button not working to display records on onclick event
Hi
I have a requirement to displays records in pageblock based on "OnClick" event on the pageblock button with render attribute,
That mean when ever the pageblock button is clicked records should be displayed within that pageblock, i am failing to acheive this,
help will be appreciated,
Below is my controller and Vf page code for the reference:
Controller:
public with sharing class DisplayQueryList{
public List<Account> Records {get; set;}
public DisplayQueryList(){
Records =
[select Name, AccountNumber, CleanStatus from Account where CleanStatus='Pending'];
}
}
VF Page:
<apex:page controller="TestDisplayQueryList">
<apex:form >
<apex:pageBlock title="Tabular display with facet">
<apex:pageBlockTable value="{!Records}" var="Record">
<apex:column >
<apex:facet name="header">Account Name</apex:facet>
<apex:outputText value="{!Record.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Account Number</apex:facet>
<apex:outputText value="{!Record.AccountNumber}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Clean Status</apex:facet>
<apex:outputText value="{!Record.CleanStatus}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="Tabular Display without facet">
<apex:pageBlockTable value="{!records}" var="record">
<apex:column value="{!record.Name}"/>
<apex:column value="{!record.AccountNumber}"/>
<apex:column value="{!record.CleanStatus}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
I have a requirement to displays records in pageblock based on "OnClick" event on the pageblock button with render attribute,
That mean when ever the pageblock button is clicked records should be displayed within that pageblock, i am failing to acheive this,
help will be appreciated,
Below is my controller and Vf page code for the reference:
Controller:
public with sharing class DisplayQueryList{
public List<Account> Records {get; set;}
public DisplayQueryList(){
Records =
[select Name, AccountNumber, CleanStatus from Account where CleanStatus='Pending'];
}
}
VF Page:
<apex:page controller="TestDisplayQueryList">
<apex:form >
<apex:pageBlock title="Tabular display with facet">
<apex:pageBlockTable value="{!Records}" var="Record">
<apex:column >
<apex:facet name="header">Account Name</apex:facet>
<apex:outputText value="{!Record.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Account Number</apex:facet>
<apex:outputText value="{!Record.AccountNumber}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Clean Status</apex:facet>
<apex:outputText value="{!Record.CleanStatus}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="Tabular Display without facet">
<apex:pageBlockTable value="{!records}" var="record">
<apex:column value="{!record.Name}"/>
<apex:column value="{!record.AccountNumber}"/>
<apex:column value="{!record.CleanStatus}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
List<Account> Records same variable is using two page block table it won't work. just use it any one.see below modified code.
<!-----------controller---------------->
public with sharing class DisplayQueryList{
public List<Account> Records {get; set;}
public DisplayQueryList(){
Records =
[select Name, AccountNumber, CleanStatus from Account where CleanStatus='Pending'];
}
}
<!---pages--------------------------------->
<apex:page controller="TestDisplayQueryList">
<apex:form >
<apex:pageBlock title="Tabular display with facet">
<apex:pageBlockTable value="{!Records}" var="Record">
<apex:column >
<apex:facet name="header">Account Name</apex:facet>
<apex:outputText value="{!Record.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Account Number</apex:facet>
<apex:outputText value="{!Record.AccountNumber}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Clean Status</apex:facet>
<apex:outputText value="{!Record.CleanStatus}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Regards,
Babaiahgari Eswar
Hi Eswar thanks for the suggestion, but actually i have just pasted in hurry,you could ignore the 2nd page block,for example lets consider only 1st block All i need is 2 pageblock button like when button A clicked records should be displayed when button B clicked records should B hidden preferebly with actionsupport or actionFunction with render attribute.
Thanks
ckrdy
Please try below code:
Important :
If this is what you were looking for then please mark it as a "SOLUTION" or You can Click on the "Like" Button if this was beneficial for you.