+ Start a Discussion
DS777DS777 

PageBlock column wrapping

How to avoid wrapping of table column values?
 
<apex:PageBlock >
    <apex:pageBlockButtons >
                             <apex:commandButton value="Save"   action="{!save}"></apex:commandButton>
                             <apex:commandButton value="Cancel" action="{!cancel}">
    </apex:commandButton>
</apex:pageBlockButtons>
<apex:pageBlockSection > 
<apex:pageBlockTable value="{!test}" var="pick" > 
            <apex:column headervalue="{!$ObjectType.testDetail__c.Fields.testQuantity__c.label}"><apex:outputfield value="{!test.PickQuantity__c}"/></apex:column>    
      <apex:column headervalue="{!$ObjectType.testtDetail__c.Fields.StockUM__c.label}"><apex:outputField value="{!test.StockUM__c}"/></apex:column>  
      <apex:column ></apex:column> 
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:PageBlock>
mtbclimbermtbclimber
Four things:

#1 Use the SRC button in the toolbar when putting sample code into your posts. Currently we are aware that safari doesn't show the toolbar. Please use firefox or IE to post here and use the SRC button to avoid seeing emoticons/smileys littered throughout your page markup per above.

#2 Not sure if your intention was to have a different label in the 1st column than the field that is output (testQuantity__c vs PickQuantity__c) but from what I can tell you just want the field label to show up in the header column and the value to be output in the column cell itself. If that is the case then you can just use the value attribute on your column like this:

Code:
<apexageBlockTable value="{!pick}" var="test" > 
      <apex:column value="{!test.PickQuantity__c}"/>
      <apex:column value="{!test.StockUM__c}"/>
</apexageBlockTable> 

(notice no emoticons/smileys in my sample)

 #3 you seemed to have the value/var attribute values on pageblocktable switched in your sample.  I updated my example above to have what would seem to be the correct values, assuming your controller (not provided) has a pick property or getPick method that is typed/returns a collection of testDetail__c objects.

#4 to actually answer your direct question - yes you can avoid value wrapping with basic CSS techniques.  I suggest you refer to a CSS reference, something like gotapi.com for example to find how to specify the desired output formatting to define a custom style after which you'll be applying your style to pageBlockTable.columnClasses I suspect.