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
willardwillard 

PageBlockTable and outputText

I'm having some issues getting the values in my var attribute when using apex:column and apex:outputText.

 

Say I have the following pageBlockTable:

<apex:pageBlockTable value="{!charges}" var="a" id="adjustment_charges">
  <apex:column headerValue="Amend Action" value="{!a.Local_Price__c}" />
  <apex:column headervalue="test">
    <apex:outputText >
       <apex:param value="{!a.Local_Price__c}"/>
     </apex:outputText>
                    
   </apex:column>
</apex:pageBlockTable>

 For me, the first column prints out the local price, while the second "test" column prints out blank

 

Any ideas what I am doing wrong?

Neeraj_ChauriyaNeeraj_Chauriya

Hi willard,

 

No need of using <apex:param> to print the value of a field, directly bind it with the <apex:outputText>:

 

<apex:pageBlockTable value="{!charges}" var="a" id="adjustment_charges">
  <apex:column headerValue="Amend Action" value="{!a.Local_Price__c}" />
  <apex:column headervalue="test">
    <apex:outputText value="{!a.Local_Price__c}"/>                   
  </apex:column>
</apex:pageBlockTable>

 

Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other's benefit.

 

asish1989asish1989

Try this

<apex:pageBlockTable value="{!charges}" var="a" id="adjustment_charges">
  <apex:column headerValue="Amend Action" >
  
    <apex:outputText value="{!a.Local_Price__c}"/>                   
  </apex:column>
</apex:pageBlockTable>
souvik9086souvik9086
<apex:pageBlockTable value="{!charges}" var="a" id="adjustment_charges">
  <apex:column headerValue="Amend Action" value="{!a.Local_Price__c}" />
  <apex:column headervalue="test">
    <apex:outputText value="{!a.Local_Price__c}"/>
   </apex:column>
</apex:pageBlockTable>

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

willardwillard

Sorry - I posted a simplified example, I actually do need the param value there since I want to format the field.

 

More accurate code, where it prints out some_date__c in the first column, but not the second:

<apex:pageBlockTable value="{!charges}" var="a" id="adjustment_charges">
  <apex:column headerValue="some date" value="{!a.some_date__c}" />
  <apex:column headervalue="test">
    <apex:outputText value="{0,date,MM/dd/yyyy}">
       <apex:param value="{!a.some_date__c}"/>
     </apex:outputText>
   </apex:column>
</apex:pageBlockTable>

 

Avidev9Avidev9
Any specific reason you are not using value attribute for the date thing in column ?
When you use value attribute to merge the fields it will automatically take care of the date/currency etc formatting based on user locale.
Ankit GuptaAnkit Gupta
<apex:param> is only used to assign parameters so that u can use in the apex class by referring to it like apexpages.currentpage().getparameters().get('id'). It will not display the value.