Creating Multiple PageBlockTables Dynamically

By | May 5, 2016

Creating Multiple PageBlockTables Dynamically

There are times when we want to display the table dynamically. Not just the columns, but we might come across a scenario where we the table needs to be repeated itself fetching the data dynamically, which could change on fly. For example, the user can chose a list of first names, and we want to show the contacts with the same names in separate table. Here the user can select just a single name as the query parameter, or can select multiple. Our static pageblock table will not work here as it is, but can be used in combination to repeat tag to achieve the same

Steps to Repeat multiple pageblocktable Using Repeat Tag:

  1. Controller:
    In this we can first create list of list of contact records which would store contacts for multiple tables. Based on the criteria selected by the end user, we can add new list of contacts. This list of contact can then added as a property in our controller, which can in turn be used to bind the data with the tables in the VisualForce page.Multiple PageBlockTables
  2. VisualForce page:
    Bind the controller to VisualForce page and use repeat tag to iterate the contents of collection and create the pageblocktable accordingly. Pageblocktable can now be created dynamically.

Multiple PageBlockTables

Here is the output of VisualForce page:

Multiple PageBlockTables

About Us
Greytrix as a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners across the globe. We offers Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that requires apex code incorporation into the Salesforce platform.

Greytrix has some unique solutions for Cloud CRM such as Salesforce integration with Sage Enterprise Management (Sage X3), Sage Intacct, Sage 100 and Sage 300 (Sage Accpac). We also offer best-in-class Cloud CRM Salesforce customization and development services along with services such as Salesforce Data Migration, Integrated App development, Custom App development and Technical Support to business partners and end users.

Greytrix GUMU™ integration for Sage ERP – Salesforce is a 5-star app listed on Salesforce AppExchange.

For more information, please contact us at salesforce@greytrix.com. We will be glad to assist you.