3

So I'm trying to make THIS see pic, into One single table, so it's easier for my jQuery plug-in that Sorts (tableSorter).

enter image description here

(if you can't see - 3 column pageblock Section, 3 tables with nicely aligned outputlabels)

I've played with lots of things, and so far I haven't been able to google anything that points me in the right direction. Here is my somewhat Redacted code. How do I get this table to span all 3 columns, instead of just one?

 <apex:pageBlockSection id="clientListSearchResults" title="Search Results" rendered="{!wrapClient.size >0}" columns="3">

       <apex:outputlabel />
       <apex:outputLabel value="X"/>
       <apex:outputLabel value="Y"/>

       <apex:pageblocktable value ="{!X}" var="c" id="Y" styleclass="tablesorter">
           <apex:column value="{!c.X}" headervalue="Y" />
           <apex:column value="{!c.X}" headervalue="Y" />
           <apex:column value="{!c.X}" headervalue = "Y/>
           <apex:column value="{!c.X}" headervalue = "Y"/>
           <apex:column value="{!c.X}" headervalue = "Y"/>
           <apex:column value="{!c.X}" Headervalue = "Y"/>
           <apex:column value="{!c.X}" headervalue="Y" />
           <apex:column value="{!c.X}" headervalue = "Y"/>
           <apex:column value="{!c.X}" headervalue = "Y"/>
           <apex:column value="{!c.X}" headervalue = "Y"/>
           <apex:column value="{!c.X}" headervalue = "Y"/>
       </apex:pageblocktable>

   </apex:pageBlockSection>

EDIT: fixed for clarity!

1

The way you've redacted this makes it difficult to understand exactly what you're trying to do. But I think the answer will lie somewhere in the wrapper class pattern. So instead of there being three separate lists of data, there is one list...and thus one single table.

So essentially you have an apex class with a bunch of properties. It can be standalone, or an inner class.

public class MyWrapper {

  public String wrapperName {get;set;}
  public Integer measure1 {get;set;}
  public Integer measure2 {get;set;}
  public Integer measure3 {get;set;}
  public Integer measure4 {get;set;}
  public Integer measure5 {get;set;}
  public Integer measure6 {get;set;}
  public Integer measure7 {get;set;}

}

You can then martial together data into lists of that class.

public List<MyWrapper> someData {get;set;}

Then you need to get the data into it. Let's say the "Name" is from an account.

someData = new List<MyWrapper>();

for (Account a : aListOfAccounts) {

  MyWrapper item = new MyWrapper();
  item.wrapperName = a.Name;
  item.measure1 = a.SomeCustomField__c;
  item.measure2 = mapOfSomeStuff.get(a.Id).SomeMeasureField__c;
  item.measure3 = mapOfSomeOtherStuff.get(a.Id).SomeOtherMeasureField__c;
  ...and so on...

}

Then you have one page block table to work with:

<apex:pageBlockTable value="{!someData}" var="item">
  <apex:column value="{!item.wrapperName}"/>
  <apex:column value="{!item.measure1}"/>
  ...and so on...
</apex:pageBlockTable>    
  • OK great, thanks for that. I should have been way more clear, my apologies! If pageblockSection has 3 columns... how do I span that PageblockTable across all 3 columns? – RC82 Jul 10 '15 at 16:12
  • @RC82 - Make a section for the table with a column out of 1 and a section for the rest with a column count of 3. – Eric Jul 11 '15 at 3:30

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.