You need to sign in to do that
Don't have an account?
Carter85
Render as PDF Question
When rendering as a PDF can I not display a dynamic grand total footer calculation in a table?
In my page I have a section like this:
In my page I have a section like this:
<apex:pageBlock > <apex:pageBlockSection title="Tire and Wheel Contracts" rendered="{!NOT(ISNULL(tcontractList))}"> <apex:variable value="{!0.00}" var="total1"/> <apex:pageBlockTable value="{!tcontractList}" style="border:1px solid black;" var="c" rendered="{!NOT(ISNULL(tcontractList))}"> <apex:column style="border:1px solid black; text-align:center; width:85px; font-weight:bold; color:blue;" id="note" value="{!c.rContract.Contract_Number__c}" headerValue="Contract #"/> <apex:column style="border:1px solid black; text-align:center; width:95px" value="{!c.rContract.Vin_Number__c}" headerValue="VIN"/> <apex:column style="border:1px solid black; text-align:center; width:125px" value="{!c.rContract.Name}" headerValue="Name"/> <apex:column style="border:1px solid black; text-align:center; width:125px; font-weight:bold; color:blue" value="{!c.rContract.Policy_Type__c}" headerValue="Policy Type"/> <apex:column style="border:1px solid black; text-align:center; width:95px" value="{!c.rContract.Term__c}" headerValue="Term"/> <apex:column style="border:1px solid black; text-align:center; width:95px" value="{!c.rContract.Class__c}" headerValue="Class"/> <apex:column style="border:1px solid black; text-align:center; width:95px" value="{!c.rContract.Benefits_Options__c}" headerValue="Option"/> <apex:column style="border:1px solid black; text-align:center; width:95px" value="{!c.rContract.Effective_Date__c}" headerValue="Purchase Date"/> <apex:column style="border:1px solid black; text-align:center; width:95px" headerValue="Dealer Cost"> <apex:outputField value="{!c.rContract.Dealer_Cost__c}" /> <apex:variable var="total1" value="tdueAmount" /> <apex:facet name="footer"> <span style="font-weight:bold; color:blue">Total Due: $<span class="t1"></span></span> </apex:facet> </apex:column> </apex:pageBlockTable> <br/> <script> // Here we will set the generated subtotals to the footer cells document.getElementsByClassName('t1')[0].innerHTML = '{!total1}'; </script> </apex:pageBlockSection>And the only thing which does not display is the total calculation in the footer. I know it's operating correctly because I have this same code on the referring page where the user can then choose to create the PDF to print off which opens this new page where the figure does not show up. Is there some sort of restriction in the renderAs PDF option which prevents this from working properly, or is there an allowance I need to make in this situation to make sure it does show up?
I have a small recommendation for you!
I assume "tcontractList" is a wrapper class to which you were adding values (rContract is one of the property of the wrapper class). Create a Decimal varibale in Contoller called "TotalValue" which will be calculated on the controller side while you add the records to the tcontractlist wrapper class.
for eg.,
Now on vf page in the footer:
Hope it works for you!
Thanks,
Balaji
All Answers
@Carter85:
In the below document :
https://www.salesforce.com/us/developer/docs/pages/Content/pages_output_pdf_considerations.htm
It says "PDF rendering doesn’t support JavaScript-rendered content.", which i assume what the script is doing !
I have a small question for you:
why dont you use the {!Total1} directly between the span tags, instead of adding through script? - Just asking as i dont see you were adding anything dynamically to the Total value in the script itsself!
Thanks,
Balaji
I have a small recommendation for you!
I assume "tcontractList" is a wrapper class to which you were adding values (rContract is one of the property of the wrapper class). Create a Decimal varibale in Contoller called "TotalValue" which will be calculated on the controller side while you add the records to the tcontractlist wrapper class.
for eg.,
Now on vf page in the footer:
Hope it works for you!
Thanks,
Balaji
http://www.salesforce.com/docs/developer/pages/Content/pages_compref_variable.htm
In the above link it says apex varaible can not be incremented in an iteration, and that is the reason why you might not be able to render it on page unless you use script and force it to appear :), which is breaking in case of PDF.
Thanks,
Balaji