function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mehta.sagarmehta.sagar 

Can someone provide me an example of colpsan in <apex:column> for <apex:pageBlockTable>

I am trying to populate a table using <apex:pageBlockTable>.

It has columns which requires colspan on few of them. can anybody help me in this scenario.

I do not want to try colspan using <table> tag. Since normal tag would not give me the styling of <apex:pageBlockTable> tag. I could not figure out the exact code for it. Following is the code snippet:

 

      <apex:pageBlockSection >
          <apex:pageBlockTable value="{!monthlyStatementList}" var="expense">
            <apex:column headerValue="Date" value="{!expense.expenseDate}"/>
            <apex:column headerValue="Day" value="{!expense.day}"/>
            <apex:column headerValue="Town" value="{!expense.fromMarket}" colspan="2"/>

            <apex:column headerValue="Town" value="{!expense.toMarket}" colspan="2"/>
          </apex:pageBlockTable>
       </apex:pageBlockSection>

sfdcfoxsfdcfox

Colspan is only relevant is you are using multiple rows via "breakBefore" on a column. Otherwise, the browser will still set a calculated size automatically that won't be twice the size (which I presume is what you're looking for). Instead, consider using "width" instead: Set the first two columns to "16%", and set the other two columns to "34%".

mehta.sagarmehta.sagar

I want an equivalent code sample of colspan using <apex:pageBlockTable> and <apex:column> code to the following code of html table tag :

   <table>   
      <tr>
            <td>Date</td>
            <td>Day</td>
            <td colspan="2">Town</td>
      </tr>
      <apex:repeat value="{!monthlyStatementList}" var="expense">
          <tr>
            <td>"{!expense.expenseDate}"</td>
            <td>"{!expense.expenseDay}"</td>
            <td>{!expense.fromMarket}</td>
            <td>{!expense.toMarket}</td>
          </tr>
      </apex:repeat>
   </table>

I tried hard to apply colspan on <apex:column> tag but could not figure out how to to it. Is there any way i can use the visualforce tags without having to touch the html <table> tags for applying the colspan effect. And the width suggestion provided does not span the heade. Please can anyone help me in this?