You need to sign in to do that
Don't have an account?
Franco
The controller:
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; } }
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.