• Abhilash Gandhewar 5
  • NEWBIE
  • 0 Points
  • Member since 2015


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I have been trying various "examples" to create a sub-total for columns in a visualforce page and have had no luck.  The closest I have gotten is the one below, however, the <script> doesn't seem to be working as I don't get any value in the <span></span> block when I render the page.

Could anyone take a look to see if my code is missing anything ?  See the <apex:facet> at the bottom which references the place that should be populated with the total.  I have a variable that should be holding the total, but not sure how to check this.
 
<apex:page controller="fetchTimeCardEntryDataController" tabStyle="Account" docType="HTML-5.0">
    <apex:form >
        <!-- Variables to hold Totals -->
        <apex:variable value="{!0.00}" var="tMon"/>
        <apex:variable value="{!0.00}" var="Total_Tuesday"/>
        <apex:variable value="{!0.00}" var="Total_Wednesday"/>
        <apex:variable value="{!0.00}" var="Total_Thursday"/>
        <apex:variable value="{!0.00}" var="Total_Friday"/>
        <apex:variable value="{!0.00}" var="Total_Saturday"/>
        <apex:variable value="{!0.00}" var="Total_Sunday"/>
        <apex:variable value="{!0.00}" var="Total_Grand"/>
        
        <apex:pageBlock Title="Time Card Entry Report">
            <!--Start and End block along with fetch button -->
            <apex:pageBlockButtons >
                <b>Starting Date</b><apex:inputfield value="{!dum.dateOne__c}"/>
                <b>Ending Date</b><apex:inputfield value="{!dum.dateTwo__c}"/>
                <apex:commandButton value="Fetch Time Entries" action="{!fetch}"/>
            </apex:pageBlockButtons>
          
           <!-- Debug - SQL statement -->
        <!--   <apex:pageBlockSection columns="1" title="DEBUG - Dynamic SOQL Query" collapsible="True">
                <apex:outputText value="{!query}">
                </apex:outputText>
            </apex:pageBlockSection> -->
             
            <!-- Display Time Entry Date -->
          
          <apex:pageblocktable value="{!TEList}" var="tec1" id="list1">
              <apex:column width="10" title="Week Starting" value="{!tec1.Monday_Date__c}"/>
              <apex:column headerValue="Mon">
                  <apex:outputfield value="{!tec1.Monday__c}"/>
                  <apex:variable var="tMon" value="{!tMon+1+tec1.Monday__c}"/>
                      <apex:facet name="footer">
                        t<span ID="tMonday"></span>
                      </apex:facet>
               </apex:column>
          
          </apex:pageblocktable>
          
          
         </apex:pageBlock>
        
        <!-- Script for generating Totals-->
        <script>
            document.getElementsByID('tMonday')[0].innerHTML='{!tMon}';
        </script>
         
    </apex:form>
</apex:page>

 

I have a visualforce page that shows a related list and I was wondering if it was possible to add either a table row count at the bottom of a table or add row numbers?  I have tried a few different sets of code that I had found but nothing is working.   Any help would be great!  Thanks! Below is the e table:

 

<p><u>Related Claims</u></p>
<table id="claims" border="1" cellspacing="2" cellpadding="5">
<tr>
<th>Claim Number</th>
<th>Insured</th>
<th>Claimant Name</th>
<th>Policy Number</th>
<th>Claim Status</th>
<th>Date Reported</th>
<th>Examiner</th>
</tr>
<apex:repeat var="rc" value="{!Account.Claims__r}">
<tr>
<td>{!rc.Name} </td>
<td>{!rc.Insured_Lookup__r.name}</td>
<td>{!rc.Claimant_Name__c}</td>
<td>{!rc.Policy__r.name}</td>
<td>{!rc.Status__c}</td>
<td><apex:outputText value="{0,date,MM/dd/yyyy}"><apex:param value="{!rc.Date_Reported__c}"/></apex:outputText></td>
<td>{!rc.Assigned_Examiner2__r.name}</td>
</tr>
</apex:repeat>
</table>

  • November 18, 2011
  • Like
  • 0