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
FrancoFranco 

Two (hopefully) simple questions

1) Is there a way to improve the format of the number in this output?  See the example below.  This is just a test case to show the formatting.  I could be wrong but, I believe my output choices are limited since I'm using a wrapper object.
 
2) I'm having problems with the rendered attribute.  But, maybe this is the expected behavior. It seems to work when I use it in a datatable but, it does not seem to work in a pageblock. 
 
The page:
Code:
<apex:page controller="FormatController"> 
<apex:form >
  <apex:pageBlock title="Do It">
      <apex:commandButton action="{!DoIt}" value="Go" rerender="Opps" status="status"/> <br />
      <apex:pageMessages ></apex:pageMessages>
  </apex:pageBlock>
  <apex:pageBlock title="Opps" id="Opps" rendered="{!NOT(ISNULL(Opportunities))}">
  <apex:dataTable value="{!Opportunities}" var="Opp" width="100%" >     
     <apex:column >
      <apex:facet name="header">Account</apex:facet>
      {!Opp.Account.Name}
     </apex:column>
      <apex:column >
      <apex:facet name="header">Name</apex:facet>
      {!Opp.Name}
     </apex:column>
     <apex:column >
      <apex:facet name="header">Amount</apex:facet>
      {!Opp.Amount}
     </apex:column>
   </apex:dataTable> 
   </apex:Pageblock>
</apex:form>

</apex:page>

 The controller:
Code:
public class FormatController {

    private List<Opportunity> Opportunities {get; set;}
    public List<Opportunity> getOpportunities (){
        return Opportunities;
    }

    public PageReference DoIt (){
          if(Opportunities == null){
              Opportunities = [Select Name, Amount, Account.Name FROM Opportunity Limit 10  ];
          }
        return null;
    }
}

 

mtbclimbermtbclimber
As long as your wrapper exposes the SObject you can still bind your columns to the field by traversing the wrapper to the sobject to the respective field:

Code:
<apex:column value="{!wrapperInstance.opportunity.amount}"/>

 
Try wrapping your pageblock in an output panel that is always rendered and make it the target for your rerender for the second issue.

Also, if you are only putting text in your column header then you don't need the facet. Only use the facet if you need to put components or other markup in the header. Otherwise use headerValue or if your field labels are ok then binding to the field should take care of the label.

Finally if you are looking to make this appear in the style of salesforce try pageblocktable instead of datatable.