如何在素面过滤器中显示水印? [英] How to show water mark in filter in primefaces?

查看:192
本文介绍了如何在素面过滤器中显示水印?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有用于列的过滤器.

我想在过滤器中显示水印(如图中红色圆圈所示)

Here i want to show water mark in filter (As Shown in figure in red circle)

我正在使用素面3.4

I am using prime faces 3.4

我已经尝试过了

<h:form id="parametersListForm" prependId="false">      
    <p:dataTable id="parameteresList" value="#{parameterController.lstParameter}" 
                     var="parameters" selectionMode="single"  
                     selection="#{parameterController.selectedParameter}" 
                     styleClass="tnt-main-table"> 

            <p:ajax event="rowSelect" update=":parameterDetailsForm"
                    listener="#{parameterController.onParametersRowSelect}" />

      <p:column id="colomnRefType" filterBy="#{parameters.beRefType}" 
                 headerText="#{msgs['parameters.beRefType.label']}"
                 filterMatchMode="contains">
                                <h:outputText value="#{parameters.beRefType}"/>
            <p:watermark value="Ref Type" 
                         forElement= ":parameteresList:colomnRefType_filter">
             </p:watermark>
        </p:column>
      </p:dataTable>              
    </h:form>

我该如何实现?

推荐答案

对此有一个属性forElementp:watermark.规范指出forElement应该包含html输入组件的jquery选择器.但是根据这些主题,此处

There is an attribute forElement of p:watermark for that. The specifications state that forElement should contain jquery selector of the html input component. But according to these threads here and here, the forElement should strictly be only the client ID of the html input component.

因此您可以执行以下操作:

So you can do following:

<p:dataTable id="battingStyleTable" ... ... ..>

    <p:column id="myColumn"
        filterBy="#{battingStyle.battingStyleString}" 
        filterMatchMode="contains">

        <f:facet name="header">Name</f:facet>
        <h:outputText value="#{battingStyle.battingStyleString}" />

        <p:watermark value="Watermark text"
            forElement='battingStyleTable:myColumn_filter'></p:watermark>
        <!-- Please note that the prependId of my form is false, and id of the datatable is battingStyleTable and id of the column is myColumn. Thats why the id of the textfield of the filter will be battingStyleTable:myColumn_filter. Please change it accordingly. If you can't do prependId="false" to your form then you must include form id in the start also, like myFormId:myDatatableId:myColumnId_filter -->
    </p:column>
    ...............
    ..........
    ................
</p:dataTable>

这篇关于如何在素面过滤器中显示水印?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆