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
SjaleelSjaleel 

changing the column width in a table..

Dear Developers,

 

Am trying to change the column widths in a table that us being displayed in the VF page

 

<apex:pageBlockSection title="Equipment" >
                         
         <apex:pageBlockTable value="{!Equipment}" var="equip" >
            <apex:column value="{! equip.ATA__c}"  />
            <apex:column value="{! equip.Description__c}"  width="40%"/>
            <apex:column value="{! equip.Vendor__c}"  width="40%"/>
            <apex:column value="{! equip.Part_Number__c}" width="10%"/>
        
       </apex:pageBlockTable>                  
     
    </apex:pageBlockSection> 

 

But it doesnt seems to work, and the table is so small that it is only being displayed in a small part of the block section leaving the rest of the area empty, what could be wrong?

 

Thanks in advance

S.Aj

 

Best Answer chosen by Admin (Salesforce Developers) 
Shashikant SharmaShashikant Sharma

Just add columns="1" in pageblock section like below , the default is 2 thats why seection is coming onlly in half the page.

 

<apex:pageBlockSection title="Equipment" columns="1">


                         
         <apex:pageBlockTable style="width:100%" value="{!Equipment}" var="equip">
            <apex:column value="{! equip.ATA__c}" />
            <apex:column style="width:150px" value="{! equip.Description__c}"/>
            <apex:column style="width:150px" value="{! equip.Vendor__c}" />
            <apex:column value="{! equip.Part_Number__c}"/>
        
       </apex:pageBlockTable>                  
     
    </apex:pageBlockSection>

 let me know with result

All Answers

CodeFinderCodeFinder

Can you try it like this?

 

 

<apex:pageBlockSection title="Equipment" columns="1" >

<apex:pageBlockTable value="{!Equipment}" var="equip" >

<apex:column headervalue="Description" width="40%">{! equip.Description__c}</apex:column>

</apex:pageBlockTable>    

</apex:pageBlockSection>

 

 

Let me know if this works

Shashikant SharmaShashikant Sharma

You can use this example

 

<apex:pageBlockTable style="width:100%" value="{!contactList}" var="con">
      <apex:column style="width:150px" value="{!con.FirstName}"/>
      <apex:column style="width:150px" value="{!con.LastName}"/>
   </apex:pageBlockTable>

 

SjaleelSjaleel

<apex:pageBlockTable style="width:100%" value="{!Equipment}" var="equip">
            <apex:column value="{! equip.ATA__c}" />
            <apex:column style="width:150px" value="{! equip.Description__c}"/>
            <apex:column style="width:150px" value="{! equip.Vendor__c}" />
            <apex:column value="{! equip.Part_Number__c}"/>
        
       </apex:pageBlockTable>     

 

Still no change the table appears to be expanded while the window is loading but once its loaded it appearing on only the half side of the block section

 



Thanks and regards

S.Aj

Shashikant SharmaShashikant Sharma

Please share complete code of your VFP, it looks that you must be using a page block section with columns="2"  , if so change it to 1 ,

but still I would like to see your comple code.

SjaleelSjaleel

Here's the VF code for the page,

 

<apex:page controller="AircraftController">
   <apex:sectionHeader title="Aircraft Specification Sheet"/>
       <apex:form >
    <apex:pageMessages />
    <apex:pageBlock title="AIRCRAFT {!parentAC.Aircraft_Type__c} TECHNICAL SPECIFICATION" >
   
 
      <apex:pageBlockButtons >
        <apex:commandButton action="{!sendPdf}" value="Send PDF"/>
        <apex:commandButton value="Preview"
                    onclick="window.open('/apex/AcSpecSheet?id={!parentAC.id}', 'Popup',
                            'height=500,width=600,left=100,top=100,resizable=no,
                            scrollbars=yes,toolbar=no,status=no');" />
      </apex:pageBlockButtons>
     
      <apex:pageBlockSection >
   
          <apex:pageBlockSectionItem >
            <apex:outputLabel value="Email" for="email"/>
            <apex:inputText value="{!email}" id="email"/>
          </apex:pageBlockSectionItem>
 
     </apex:pageBlockSection>
    
      <apex:pageBlockSection title="General Description">
                         
              <apex:outputField value="{!parentAC.Aircraft_Type__c}"/>           
              <apex:outputField value="{!parentAC.Registration_Number__c}"/>
              <apex:outputField value="{!parentAC.TSN__c}"/>
              <apex:outputField value="{!parentAC.CSN__c}"/>
              <apex:outputField value="{!parentAC.Aircraft_Variant__c}"/>
              <apex:outputField value="{!parentAC.Approach_Landing_Cat__c}"/>
              <apex:outputField value="{!parentAC.Line_Num__c}"/>
              <apex:outputText value="Status As Of{0,date,MM'/'dd'/'yyyy}">
                   <apex:param value="{! TODAY()}" />
                   </apex:outputText>
        
        
         </apex:pageBlockSection>

      
      <apex:pageBlockSection title="Weights">
                         
        <apex:outputField value="{!parentAC.Maximum_Operational_Take__c}"/>
        <apex:outputField value="{!parentAC.Maximum_Take_Off_Weight_Operational__c}"/>
        <apex:outputField value="{!parentAC.Maximum_Take_Off_Wt_Max_Design__c}"/>
        <apex:outputField value="{!parentAC.Maximum_Landing_Weight_Operational__c}"/>
        <apex:outputField value="{!parentAC.Maximum_Landing_Wt_Purchased_Leased__c}"/>
        <apex:outputField value="{!parentAC.Maximum_Landing_Weight_Max__c}"/>
        <apex:outputField value="{!parentAC.Maximum_Zero_Fuel_Wt_Operational__c}"/>
        <apex:outputField value="{!parentAC.Maximum_Zero_Fuel_Wt_Purchased_Leased__c }"/>
        <apex:outputField value="{!parentAC.Maximum_Zero_Fuel_Wt_Max_Design__c}"/>
     
      </apex:pageBlockSection>
     
      <apex:pageBlockSection title="Fuel">
                         
        <apex:outputField value="{!parentAC.Standard_Fuel_Capacity_Pounds__c}"/>
        <apex:outputField value="{!parentAC.Standard_Fuel_Capacity_KG__c}"/>
        <apex:outputField value="{!parentAC.Standard_Fuel_Capacity_Gallons__c}"/>
        <apex:outputField value="{!parentAC.Auxillary_Tank_Capacity_Pounds__c}"/>
        <apex:outputField value="{!parentAC.Auxiliary_Tank_Capacity_Kilograms__c}"/>
        <apex:outputField value="{!parentAC.Auxiliary_Tank_Capacity_Gallons__c}"/>
     
      </apex:pageBlockSection>
   
    <apex:pageBlockSection title="Landing Gear">
                         
        <apex:repeat value="{!ConstAssembGear}" var="CAgear">
        
          <apex:outputField value="{!CAgear.Type__c}"/>
          <apex:outputText value=""/>
          <apex:outputField value="{!CAgear.Part_Number__c}"/>
          <apex:outputField value="{!CAgear.Serial_Number__c}"/>
          <apex:outputField value="{!CAgear.TSN__c}"/>
          <apex:outputField value="{!CAgear.CSN__c}"/>
          <apex:outputField value="{!CAgear.TSLV__c}"/>
          <apex:outputField value="{!CAgear.CSLV__c}"/>
       
        </apex:repeat>
     
      </apex:pageBlockSection>
 
    <apex:pageBlockSection title="Engines">
                         
        <apex:repeat value="{!ConstAssembEngine}" var="CA" id="theRepeat">
       
          <apex:outputField value="{!CA.Type__c}"/>
          <apex:outputText value=""/>
          <apex:outputField value="{!CA.Serial_Number__c}"/>
          <apex:outputField value="{!CA.Life_Limit__c}"/>
          <apex:outputField value="{!CA.TSN__c}"/>
          <apex:outputField value="{!CA.TSLV__c}"/>
          <apex:outputField value="{!CA.CSN__c}"/>
          <apex:outputField value="{!CA.CSLV__c}"/>
     
      </apex:repeat>             
     
    </apex:pageBlockSection>
  
    <apex:pageBlockSection title="APU">
                         
        <apex:repeat value="{!ConstAssembAPU}" var="apu" id="apuRepeat">
          <apex:outputField value="{!apu.Serial_Number__c}"/>
          <apex:outputField value="{!apu.Part_Number__c}"/>
          <apex:outputField value="{!apu.TSN__c}"/>
          <apex:outputField value="{!apu.CSN__c}"/>
          <apex:outputField value="{!apu.TSLV__c}"/>
          <apex:outputField value="{!apu.CSLV__c}"/>
          <apex:outputText value="Cycles Status As Of"/>
        </apex:repeat>                   
     
    </apex:pageBlockSection>
   
    <apex:pageBlockSection title="Equipment" >
                         
         <apex:pageBlockTable style="width:100%" value="{!Equipment}" var="equip">
            <apex:column value="{! equip.ATA__c}" />
            <apex:column style="width:150px" value="{! equip.Description__c}"/>
            <apex:column style="width:150px" value="{! equip.Vendor__c}" />
            <apex:column value="{! equip.Part_Number__c}"/>
        
       </apex:pageBlockTable>                  
     
    </apex:pageBlockSection>
 
    </apex:pageBlock>
    <apex:pageMessages />
  </apex:form>
</apex:page>

Shashikant SharmaShashikant Sharma

Just add columns="1" in pageblock section like below , the default is 2 thats why seection is coming onlly in half the page.

 

<apex:pageBlockSection title="Equipment" columns="1">


                         
         <apex:pageBlockTable style="width:100%" value="{!Equipment}" var="equip">
            <apex:column value="{! equip.ATA__c}" />
            <apex:column style="width:150px" value="{! equip.Description__c}"/>
            <apex:column style="width:150px" value="{! equip.Vendor__c}" />
            <apex:column value="{! equip.Part_Number__c}"/>
        
       </apex:pageBlockTable>                  
     
    </apex:pageBlockSection>

 let me know with result

This was selected as the best answer
SjaleelSjaleel

 

Thanks for the help, solved the problem....just didnt know that there is a default value for the columns, I guess just over looked on the 1st reply too, thank you both for the help.

 

Thanks and Regards

S.Aj

Shashikant SharmaShashikant Sharma

Your welcome sjaleel

CodeFinderCodeFinder

I mentioned the exact same thing in my code. Good that u got it working. u r welcome buddy.