I am trying to build a PageBlockTable inside another PageBlockTable, so I can add the master data in the master table and each row will has a detailed table.

The table I want ti build

So I am thinking of this

<apex:pageBlockTable value="{!List<Objict>}" var="obj">
  <apex:column >
    <apex:facet name="header">
      <apex:commandLink value="Code"/>
    <apex:outputField value="{!obj.Name}"/>

   <!-- and repeat <apex:column> for 6 times. Then I want to add the table  -->


So how could I do this ?

  • 2
    While this is possible, for UX optimizations sake though, wouldn't it be better to have your table of the master data, and use some JS to allow the user to click a row, and then the details for that row render in a section under the table? I would think that would be a much better user experience. Are you comfortable with a solution like this? Feb 11, 2014 at 12:38
  • @sfdc_ninja, I would go with that if it doesn't work with me that way. I'm thinking of something like "colspan" to add this table. but thanks mate. Feb 11, 2014 at 12:47
  • apex:pageblockTable can only have apex:column children. So you'd have to step away from the standard VF pageblockTable and e.g. use apex:repeat in combination with standard HTML tags. Feb 11, 2014 at 13:05
  • I've been successful nesting one apex:pageBlockTable within a column of the enclosing pageBlockTable. But this won't get you the layout you want as the enclosed pageBlockTable width is only the width of its parent column
    – cropredy
    Feb 11, 2014 at 19:55
  • I guess it would be helpful, share it with us if it's ok @crop1645 :) Feb 12, 2014 at 13:58

1 Answer 1


Instead of an apex:pageBlockTable tag, why not use regular html? Style it properly and you could do whatever you wanted.

You must log in to answer this question.

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