You need to sign in to do that
Don't have an account?
Fowkes1985
Change which column is totalled in VisualForce Page
I have the following code which totals a column.
<table class="remit">
<tr>
<th>Camp Ref</th>
<th>Start Date</th>
<th>Duration</th>
<th>Role</th>
<th>Pay</th>
<th>Holiday</th>
<th>Total</th>
</tr>
<apex:repeat value="{!ctsList}" var="cts">
<tr>
<apex:repeat value="{!$ObjectType.Camp_To_Staff__c.FieldSets.Remittance_Columns}" var="f">
<td>
<apex:outputField value="{!cts[f]}"/>
<!-- <apex:outputtext value="{!cts[f]}" rendered="{!f.fieldPath != 'Course_Start_Date__c'}" />
<apex:outputText value="{0,date,dd/MM/yyyy}" rendered="{!f.fieldPath == 'Course_Start_Date__c'}">
<apex:param value="{!NOW()}" />
</apex:outputText>
-->
</td>
</apex:repeat>
</tr>
</apex:repeat>
<tr class="totals">
<td colspan="6" class="label" style="text-align: right">
TOTAL
</td>
<td>
<apex:outputText value="{0, number, '£'##,###.00}">
<apex:param value="{!total}" />
</apex:outputText>
</td>
</tr>
</table>
</body>
</apex:page>
Currently this totals the Pay Rate column (column 5), but I wish to total the Total column (column 7) and am not sure how this i referenced. Any help please?
<table class="remit">
<tr>
<th>Camp Ref</th>
<th>Start Date</th>
<th>Duration</th>
<th>Role</th>
<th>Pay</th>
<th>Holiday</th>
<th>Total</th>
</tr>
<apex:repeat value="{!ctsList}" var="cts">
<tr>
<apex:repeat value="{!$ObjectType.Camp_To_Staff__c.FieldSets.Remittance_Columns}" var="f">
<td>
<apex:outputField value="{!cts[f]}"/>
<!-- <apex:outputtext value="{!cts[f]}" rendered="{!f.fieldPath != 'Course_Start_Date__c'}" />
<apex:outputText value="{0,date,dd/MM/yyyy}" rendered="{!f.fieldPath == 'Course_Start_Date__c'}">
<apex:param value="{!NOW()}" />
</apex:outputText>
-->
</td>
</apex:repeat>
</tr>
</apex:repeat>
<tr class="totals">
<td colspan="6" class="label" style="text-align: right">
TOTAL
</td>
<td>
<apex:outputText value="{0, number, '£'##,###.00}">
<apex:param value="{!total}" />
</apex:outputText>
</td>
</tr>
</table>
</body>
</apex:page>
Currently this totals the Pay Rate column (column 5), but I wish to total the Total column (column 7) and am not sure how this i referenced. Any help please?
Best Answer chosen by Fowkes1985
bob_buzzard
This is being totalled in the page controller I would say - the {!total} is merge syntax to access a total property from the controller. You'll need to edit the apex code to make it sum a different value.