1

I'm on Primefaces 6.2 and I have a p:dataTable with the below structure:

<h:form id="infocenterform">
...
...
    <p:dataTable id="infocentertable" ...>
    ...
    ...
    <p:column id="infocenterthemacolumn" style="width: 60%;" filterBy="#{eintrag.thema}" headerText="Thema" filteredValue="#{marketingPagesController.filteredEintragList}" sortBy="#{eintrag.thema}" filterMatchMode="contains">

            <h:outputLink value="#{eintrag.file}" target="_blank" >
                <h:outputText value="#{eintrag.thema}"/>
            </h:outputLink>                                  

            <p:watermark for="@(#infocenterform\\:infocentertable\\:infocenterthemacolumn\\:filter)" value="Search with a keyword" /> 

    </p:column>

The watermark text isn't getting displayed (the page rendering, filtering, sorting etc. all work fine). I referred to the watermark syntax as suggested by folks for PF 6.1 on this page: How to show water mark in filter in primefaces?

Any idea what I'm doing wrong?

Tatha
  • 131
  • 1
  • 13
  • Just try ` ` – Melloware Sep 08 '19 at 11:43
  • Another thing to try is Press F12 in Chrome to bring up the JS Console and enter this script `$('#infocenterform\\: infocentertable\\: infocenterthemacolumn\\:filter').attr('placeholder','Search with a keyword');` When you run that script in the console you should see your watermark appear in the filter. – Melloware Sep 08 '19 at 11:50
  • @Melloware Thanks a lot for the suggestions. Sadly, neither of these two worked in my case. I don't get the watermark text. I think there may be something else wrong with my code, possibly? My xhtml is using composition..does that matter for the watermark? – Tatha Sep 09 '19 at 05:33
  • Btw, I tried this other approach using the styleClass attribute and it brings up the watermark text: ` ` ...but on the other hand, having the watermark this way is badly affecting the speed of filtering the column..I don't know why. – Tatha Sep 09 '19 at 05:35
  • (the styleClass way is discussed here: https://stackoverflow.com/questions/13018868/how-to-add-placeholder-text-in-the-filter-box-in-datatable-column-headers ) – Tatha Sep 09 '19 at 05:39

1 Answers1

1

Updates: This syntax did work ultimately for me...but I had to change the double slashes to single slashes as below :)

<p:watermark for="@(#infocenterform\:infocentertable\:infocenterthemacolumn\:filter)" value="Search with a keyword" />

(followed from this post: Column Filter Watermark is Not Showing in PrimeFaces in 6.0.19 Onwards)

Tatha
  • 131
  • 1
  • 13