+ Start a Discussion
Brad BothBrad Both 

Having a problem with maintaining blockpageTable column widths

I am creating a Program Report which is being populated by multiple objects. At the very top it has all the general information for the program. In this instance we'll say "Name", "System", "Status", "State". So because we are rendering as a PDF but still wanted to use our companies font I created images to act as headers for each table and am not displaying the header for each pageblockTable including this one.

When I initially created it I used columnswidth to break the 6 columns to line up perfectly with the image above it. This worked regularly for multiple system and multiple program reports. I then brought the visualforce page into production and now my columnswidth aren't being maintained at all and I would need to adjust the numbers manually for whatever reason.

Here is the apex code that is creating the table. And depending on the program these widths change, and it has nothing to do with the information in the cells as the information won't fill a whole cell, it is at most 7 letters. Like I said, when this was created, those % values worked fine, but now they aren't and what's even weirder to me is sometimes the table will only fill up half the page, so the last column ends at half the page length, sometimes 70% of the page length but never like it was in the Sandbox

<apex:pageBlockSection columns="1">
<apex:pageblockTable headerClass="hideTableHeader" value="{!myProgram}" var="ProgramID" columnsWidth="30%, 22%, 12%, 12%, 12%, 12%">
<apex:column styleclass="ProgName" value="{!ProgramID.name}"/>
<apex:column styleclass="topContent" value="{!ProgramID.Electrical_System__c}"/>
<apex:column styleclass="topContent" value="{!ProgramID.Bootloader__c}"/>
<apex:column styleclass="topContent" value="{!ProgramID.Base_Program__c}"/>
<apex:column styleclass="topContent" ><apex:outputText value="{!if((myProgram.Active__c)=true, "Active", "Inactive")}"/></apex:column>
<apex:column styleclass="topContent"  value="{!myProgram.Status_Reason__c}"/>

Hi Brad,
Check this--> https://developer.salesforce.com/forums/?id=906F0000000970EIAQ
Hope it helps!
Brad BothBrad Both
Not sure how to reply to you Mammu4 but I'll add more information here

Alright let's dive into it. I've gotten rid of the pageblockSection and wrapped this in pageBlock. Here is what it looks like right now, I've went from using columnsWidth to width within each column, both cause the same issues. So here is what it looks like at the moment.
User-added image
So in this my values add up to 100%, and yet my table looks ridiculous. I have a feeling that it has to do with the last column having a value higher than ~10% Next I do this:
User-added image
I open up a different Program Report, with the same values, and no pageBlockSection. Yes my widths are no where near the same. Not sure if it helped anything. Now I got back to the inital program report and start messing with my values.
User-added image
So here I got rid of the decimals even though they shouldn't make a difference, I also lowed that last column from 16 to 12, and note that it isn't nearly as bad as the first time. I keep tweaking:
User-added image
Okay I'm getting pretty damn close to where I need everything. Awesome, but I need to shrink the base column, as the state column in order to bring the status column in line with the header. So I make an attempt to do that:
User-added image
Changing the values, maintaining 100%, very similar to my last set, noticeably the 12% in the last has gone up to 14% and again seems to cause the table to shift left for a reason I can't explain.

Thanks for any help
Brad BothBrad Both
New info, I attempted to add a column on both ends to act as a padding as whenever I attempted to bring the last column beyond a certain value it crunched the table to about half the width of the page. It seemed to be working fairly well but it still breaks down on certian reports. I have no rhyme or reason why VF isn't honouring my column widths from Program to Program. I assumed the point of this was to have some uniformity across my documents and allow me to dynamically populate them. If it can't maintain page widths from page to page what's the point?