You need to sign in to do that
Don't have an account?
grigri9
DataTable headers only appear on the first page
I'm rendering a VF page to pdf and a datatable on that page spans multiple pages. How do I get the table headers to appear on every page?
Adding the following to my CSS doesn't make a difference.
thead {display: table-header-group}
--Greg
Hi, i have create a workaround:
first of all i create a class in my extensions Controller with count a index for the rows
public class ZaehlerPositionen
{
public Integer index {get; set;}
public Zaehlerstand__c zapos {get; set;}
public ZaehlerPositionen(Integer i, Zaehlerstand__c za)
{
index = i;
zapos = za;
}
}
Then i've set several Div tags there inherit the page-break and display none or block statements into the repeat tag.
<apex:outputPanel layout="inline">
<table border="0" cellpadding="0" cellspacing="0" width="84%">
<tr>
<td colspan="4">Zählerdetails für den Berechnungszeitraum {!DAY(Faktura__c.RGVon__c)}.{!MONTH(Faktura__c.RGVon__c)}.{!YEAR(Faktura__c.RGVon__c)} bis {!DAY(Faktura__c.RGBis__c)}.{!MONTH(Faktura__c.RGBis__c)}.{!YEAR(Faktura__c.RGBis__c)}</td>
<td colspan="4"><apex:image url="{!URLFOR($Resource.spotBlank)}" width="10" height="30"/></td>
<tr>
<td class="mytdStyle"><apex:outputText value="Zähler Name" styleClass="myRechHeader"/></td>
<td class="mytdStyle"><apex:outputText value="Name" styleClass="myRechHeader"/></td>
<td class="mytdStyle"><apex:outputText value="Anzahl" styleClass="myRechHeader"/></td>
<td class="mytdStyle"><apex:outputText value="Datum" styleClass="myRechHeader"/></td>
<!--<td><apex:outputText value="Index" styleClass="myRechHeader"/></td>-->
</tr>
<apex:repeat value="{!ResultsZaehlerDetails2}" var="z">
<tr>
<td colspan="4"><div style="display:{!IF(z.index = 0,'block','none')};page-break-before:always;">Zählerdetails für den Berechnungszeitraum {!DAY(Faktura__c.RGVon__c)}.{!MONTH(Faktura__c.RGVon__c)}.{!YEAR(Faktura__c.RGVon__c)} bis {!DAY(Faktura__c.RGBis__c)}.{!MONTH(Faktura__c.RGBis__c)}.{!YEAR(Faktura__c.RGBis__c)}</div></td>
<td colspan="4" valign="bottom"><div style="display:{!IF(z.index = 0,'block','none')};"><apex:image url="{!URLFOR($Resource.spotBlank)}" width="10" height="30"/></div></td>
<tr>
<tr>
<!--<td style="border-bottom:{!IF(z.index = 0,'1px solid gray;','')}"><div style="display:{!IF(z.index = 0,'block','none')};page-break-before:always;"><apex:outputText value="Zähler Name" styleClass="myRechHeader"/></div></td>-->
<td valign="bottom" style="border-bottom:{!IF(z.index = 0,'1px solid gray;','')}"><div style="display:{!IF(z.index = 0,'block','none')};"><apex:outputText value="Zähler Name" styleClass="myRechHeader"/></div></td>
<td valign="bottom" style="border-bottom:{!IF(z.index = 0,'1px solid gray;','')}"><div style="display:{!IF(z.index = 0,'block','none')};"><apex:outputText value="Name" styleClass="myRechHeader"/></div></td>
<td valign="bottom" style="border-bottom:{!IF(z.index = 0,'1px solid gray;','')}"><div style="display:{!IF(z.index = 0,'block','none')};"><apex:outputText value="Anzahl" styleClass="myRechHeader"/></div></td>
<td valign="bottom" style="border-bottom:{!IF(z.index = 0,'1px solid gray;','')}"><div style="display:{!IF(z.index = 0,'block','none')};"><apex:outputText value="Datum" styleClass="myRechHeader"/></div></td>
<!--<td valign="bottom"><div style="display:{!IF(z.index = 0,'block','none')};"><apex:outputText value="Index" styleClass="myRechHeader"/></div></td>-->
</tr>
<tr>
<td><apex:outputText styleClass="myfont" value="{!z.zapos.Zaehler__r.Name__c}"/></td>
<td><apex:outputField styleClass="myfont" value="{!z.zapos.Name}"/></td>
<td><apex:outputField styleClass="myfont" value="{!z.zapos.Anzahl__c}"/></td>
<td><apex:outputText styleClass="myfont" value="{!DAY(z.zapos.Datum__c)}.{!MONTH(z.zapos.Datum__c)}.{!YEAR(z.zapos.Datum__c)}"/></td>
<!--<td>{!z.index}</td>-->
</tr>
</apex:repeat>
</table>
</apex:outputPanel>
I hope that helps
Regrads
Steve
Hi Steve,
Thanks a lot, that will be useful for something else I'm working on, however that doesn't help with this particular problem because my rows have a dynamic height.
I.E. some pages will have 5 rows on them and some will have 10.
--Greg