0

tried this

<apex:pageblock id="Selected_PBS">   
        <apex:pageBlockTable id="selected_contacts" value="{!SelectedContacts}" var="contact"  rendered="{!IF(SelectedContacts != NULL && SelectedContacts.size > 0,true,false)}">
             <apex:column value="{!contact.Name}" style="width: 40px;"/>
             <apex:column value="{!contact.Email}" style="width: 30px;"/>
             <apex:column value="{!contact.Phone}" style="width: 10px;"/>
        </apex:pageBlockTable>
    </apex:pageBlock> 

and this:

 <apex:pageblock id="Selected_PBS" 
        <apex:pageBlockTable columnsWidth="5%,3%,3%" id="selected_contacts" value="{!SelectedContacts}" var="contact"  rendered="{!IF(SelectedContacts != NULL && SelectedContacts.size > 0,true,false)}">
             <apex:column value="{!contact.Name}"  />
             <apex:column value="{!contact.Email}"  />
             <apex:column value="{!contact.Phone}"  />
        </apex:pageBlockTable>
    </apex:pageBlock>    

Output here:

enter image description here

2 Answers 2

0
        <b><apex:column value="{!contact.Name}" style="width:25%"/></b>

        <b> check it out , it worked for me. </b>
2
  • what do you mean "check it out , it worked for me." ?
    – Nick
    Jul 21, 2015 at 14:01
  • my bad, becoz of formatting it displayed second line only , and remove bold for you , i think its not required
    – sfdev
    Jul 21, 2015 at 14:01
1

Your percentages need to total to 100 percent. Unless you specify the Width of the Table in pixels, you can't specify the width of the cells in pixels because the pageblock table will adjust itself to fill the available space on the screen. So, generally speaking, the percentage route will be your best option. If you want to keep everything close to the left side, add an extra column which is empty but takes up a large percent of the table.

1
  • 1
    +1 for reminding me of this important caveat
    – cropredy
    Apr 10, 2019 at 21:11

You must log in to answer this question.

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