Hi My situation is this:

I have a list of different objects and every object has different fields, How can I create N Different Tables in a page ??

Example. I have this list in an class controller

ObjectName----FieldName <br>

So, with this info I have to display two different tables in a page like this:

Account table<br>

Case Table<br>

In my project I may have even 10 different objects so, I would need 10 different tables created by themself in the , with different number of columns.

I have no Idea how to do this.. someone can help me and save my life???

1 Answer 1


One option would be to use Dynamic Visualforce Components to build up various apex:pageBlockTable in Apex. With this you can programmatically build up the required apex:column's and bindings.

Your Visualforce page will be something like:

<apex:page controller="DynamicController">
    <apex:dynamicComponent componentValue="{!dynamicPanel}"/>

With a backing Controller class:

public with sharing Class DynamicController {
    public Component.Apex.OutputPanel getDynamicPanel() {
        Component.Apex.OutputPanel outPanel = new Component.Apex.OutputPanel();

        // Here you will build up the required dynamic components and add them to panel.

        return outPanel;
  • I was researshing about it and apparently this is the way, but, Im quite new in salesforce, and I dont know how to build now the tables...no idea how to do this... I mean, I need to know how having the columns and headers, how to build it! I dont know how!
    – user4882
    Dec 20, 2013 at 22:58
  • @user4882 With Dynamic Visualforce Components I find it easiest to build a static version first in a Visualforce page, and then convert it into the required apex. Have a look at some of the other questions and the Salesforce documents for more tips. Dec 21, 2013 at 8:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .