2

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:facet>
    <apex:outputField value="{!obj.Name}"/>
   </apex:column>

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

</apex:pageBlockTable>

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? – Chris Duncombe Feb 11 '14 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. – Hasan Alkhatib Feb 11 '14 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. – Guy Feb 11 '14 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 '14 at 19:55
  • I guess it would be helpful, share it with us if it's ok @crop1645 :) – Hasan Alkhatib Feb 12 '14 at 13:58
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.