function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AlessandroRicciAlessandroRicci 

Show more link on bottom PageBlockTable

Hi,

I've a custom PageBlockTable with some record. I need to create a link on bottom like "Show More" that it show me some more record like in a standard related list of an object.

How can i do? I did not found any solutions. Can you help me?

 

Thanks.

Navatar_DbSupNavatar_DbSup

Hi,

 

For this you can add a apex command link for "Show More" at the bottom of Page Block, and on click of that you can perform an action that refreshes the merge field of pageBlockTable with more data as desired , in the Last you can rerender that pageBlockTable.

You can pass the limit in the soql query .when click on the show more link call the action method and increase the limit and again execute the soql query and rerender you pageblock table.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

asish1989asish1989

Hi Navatar...

 

  Thank for your suggestion .Still I need some favor .I have added two bottom "Show 25 item" and "Show 10 Item".  I  want        at first when when page load Show 25 bottom is displayed and after clicking Show 10 item Displayed. I  have  also used Rendered property but its not working.. Kindly check and also let me know about issue..

Here is my code....

   <apex:page controller="AddShowmoreInPageBlockTableController">
          <apex:sectionHeader title="Home" subtitle="Account"/>
             <apex:form>
                  <apex:pageBlock title="Recent Accounts" >
                          <apex:pageBlockTable value="{!accts}" var="account" id="table">
                                     <apex:column headerValue="Account Name">{!account.Name}</apex:column>
                                     <apex:column headerValue="Billing City">{!account.BillingCity}</apex:column>
                                     <apex:column headerValue="Phone">{!account.Phone}</apex:column>
                          </apex:pageBlockTable><br/>
                       <apex:commandLink value="Show 25 items" action="{!showmoreAccount}" reRender="table"  />
          <apex:commandLink value="Show 10 items" onclick="window.location.reload();" rendered="{!Enable=='edit2'}"/>
           </apex:pageBlock>
        </apex:form>
 </apex:page>

 

 

my controller is..........

  public class AddShowmoreInPageBlockTableController {
         public String Enable{get;set;}
         public Account account{get;set;}
         public List<Account> accts{get;set;}
   
               public AddShowmoreInPageBlockTableController() {
                      accts = [select Id,Name,BillingCity,Phone from Account limit 10];
       
               }
           public PageReference showmoreAccount() {
                   accts =  [select Id,Name,BillingCity,Phone from Account limit 25];  
                   Enable='edit2';
                   return null;
             }
    }    
  

Thanks In Advance

asish

asish1989asish1989

Hi

   my problem is solved .I need to refress page block and pageBlockTable...

   <apex:pageBlock title="Recent Accounts" id="block">

   

        <apex:pageBlockTable value="{!accts}" var="account" id="table">

  .

  .

  .

  <apex:commandLink value="Show 25 items"  reRender="block,table" action="{!ShowmoreAccount}"   rendered="{!Enable!='edit2'}" />
            <apex:commandLink value="Show 10 items" action="{!ShowmoreAccount10}" onclick="window.location.reload();" rendered="{!Enable=='edit2'}"/>

 

Thanks

asish