I'm using Primefaces' columnToggler together with the watermark component, to add custom text to the column, following this answer -> how to add placeholder text in the filter box in datatable column headers.
<p:column id="analysisStartTimeColumn"
filterBy="#{analysis.startTime}"
sortBy="#{analysis.startTime}"
filterFunction="#{filterController.filterByDate}"
filterMatchMode="contains"
visible="#{analysisBean.analysesDatatableColumnStates.get(6)}">
<f:facet name="header">
<h:outputText value="#{msg['Analysis.startTime']}"/>
<p:watermark value="#{msg['placeholder.chooseDate']}"
for="analysisStartTimeColumn"/>
</f:facet>
<f:facet name="filter">
<p:calendar id="analysisStartTimeCalendar"
locale="de"
navigator="true"
pattern="dd.MM.yyyy"
mask="true">
<p:ajax event="dateSelect"
oncomplete="PF('analysesDatatableWdgtVar').filter()"/>
</p:calendar>
</f:facet>
<h:outputText value="#{analysis.startTime}">
<f:converter converterId="localDateTimeConverter"/>
<f:attribute name="pattern" value="dd.MM.yyyy HH:mm:ss"/>
</h:outputText>
</p:column>
The problem is, that the primefaces component gets added to the header name and therefore the header names are uglified within the columnToggler.
I know that i could place the watermark inside the column and not the header facet but then i would have to specify the "for" attribute of watermark component starting with the parent form like this: ":formId:...:tableId:columnId"... and I already read (Primefaces, dataexporter and watermark) that I would have to customize the dataExporter to not export the watermark. And I don't want to do that as it would add plenty of additional work to do.
I already found a thread (columnToggler commandButton list of column headers) with the same problem but the answer won't solve my problem..
Is there anything that i can do so the watermark is not used within the columnToggler component?
$(function(){PrimeFaces...
– Kukeltje