You need to sign in to do that
Don't have an account?
DataTable in Visual force PDF shows junk data
Hi,
When I use the apex:DataTable tag in my VF, it is showing some junk data.
The codes that I am using are:
VF page:
<apex:page controller="testController" showHeader="false" sidebar="false" renderAs="pdf">
<h2> test text </h2>
<apex:form >
<apex:pageBlock>
<apex:pageBlockTable value="{!AccountList}" var="Account" border="1" width="700">
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller class:
public class testController{
public list<Account> AccountList{get;set;}
public testController(){
AccountList = [select id,Name from Account limit 5];
}
}
This gives the output as
---------------------------------------------------------------------------------
test text
JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
2010201120122013201420152016
MonTueWedThuFriSatSun
Today
---------------------------------------------------------------------------------
The junk data does not appear when I render the page normally.
Any pointers on why this is happening and how to avoid it ?
Cross post!
This is always in place for a form, but when using standard stylesheets its in a hidden layer that gets exposed via JS when you focus on a date input field. If you don't use standard stylesheets, it just spills out at the bottom of the page because the div (or whatever) that contains it doesn't have a style that hides it any more.
All Answers
A small update.
These are the values that appear in the standard calendar select that is shown on SFDC detail pages. But I have no idea why it is coming here or how to remove it .
I removed the form tag and the junk value disappeared.
So I was able to work around it. But want to know the reason for this behaviour
You'd normally see this at the bottom of a visualforce page if you aren't including the standard style sheets. I suspect its because you have a form in your PDF page, so VF includes the elements that would support inputting of data. Presumably you can remove this as you can't enter data into a PDF?
Cross post!
This is always in place for a form, but when using standard stylesheets its in a hidden layer that gets exposed via JS when you focus on a date input field. If you don't use standard stylesheets, it just spills out at the bottom of the page because the div (or whatever) that contains it doesn't have a style that hides it any more.
Thanks Bob
I actually used the form tag to render the other contents on the PDF depending on error conditions.
Which tag do you think would be the best for this?
All I need is :
<apex:tag rendered={!myCondition}>
//all my pdf contents which include tables, panelgrid and plain text.
</apex:tag>
apex:outputPanel is a good candidate for this - its intended for grouping other components.
Thanks Bob.
Works perfectly. I'm new to VF and just getting used to the tags.
Welcome to the force. It doesn't take long to pick up the tags. Good luck!
I am having the same problem with a VF page I am trying to render as PDF. I have to use <apex:outputField> tags to output the contents of multiple rich text fields, so I need to have the <apex:form> tags on the page. Is there any CSS class I can over-ride on my stylesheet to hide the html for the date picker?
I was able to find a fix for this issue thanks to my friend Google and a poster on another board:
standardStylesheets="false" in the <apex:page> tag