【问题标题】:how to show placeholder/watermark in table filter column如何在表格过滤器列中显示占位符/水印
【发布时间】:2019-01-30 06:52:58
【问题描述】:

我在我的 .jsf 页面上添加了数据控件中的表格,并启用了可过滤选项。 现在我可以从我的表中过滤数据,但我想显示一些占位符,例如“在此处搜索”。 如何在搜索列框中显示占位符?

<af:column
    sortProperty="#{bindings.TblProgView12.hints.ProgId.name}"
    filterable="true" sortable="true" headerText="Program ID"
    align="center" id="c1" width="51">
    <af:inputText value="#{row.bindings.ProgId.inputValue}"
        label="#{bindings.TblProgView12.hints.ProgId.label}"
        required="#{bindings.TblProgView12.hints.ProgId.mandatory}"
        columns="#{bindings.TblProgView12.hints.ProgId.displayWidth}"
        maximumLength="#{bindings.TblProgView12.hints.ProgId.precision}"
        shortDesc="#{bindings.TblProgView12.hints.ProgId.tooltip}" id="it1"
        readOnly="true" contentStyle='text-align:center'>
        <f:validator binding="#{row.bindings.ProgId.validator}" />
    </af:inputText>
</af:column>

【问题讨论】:

    标签: jsf oracle-adf


    【解决方案1】:

    为您的表创建带有通知和标题的特定搜索表单的一种方法是使用迭代器附带的 af:query 组件。(从数据控件拖放您的迭代器并选择查询,在此处阅读更多信息:https://docs.oracle.com/cd/E15523_01/apirefs.1111/e12419/tagdoc/af_query.html )

    但是,当您特别问如何在搜索列框中显示占位符?

    您可以在列中添加 filter 构面来修改过滤器组件,如下所示:

    <af:column sortProperty="#{bindings.TblProgView12.hints.ProgId.name}"
           filterable="true" sortable="true"
           headerText="Program ID" align="center"
           id="c1" width="51">
           <f:facet name="filter">
                <af:inputText value="#{vs.filterCriteria.ProgId}" 
                      placeholder="SEARCH HERE" id="id4">
                </af:inputText>
            </f:facet>
        <af:inputText value="#{row.bindings.ProgId.inputValue}"
                      label="#{bindings.TblProgView12.hints.ProgId.label}"
                      required="#{bindings.TblProgView12.hints.ProgId.mandatory}"
                      columns="#{bindings.TblProgView12.hints.ProgId.displayWidth}"
                      maximumLength="#{bindings.TblProgView12.hints.ProgId.precision}"
                      shortDesc="#{bindings.TblProgView12.hints.ProgId.tooltip}"
                      id="it1" readOnly="true"
                      contentStyle='text-align:center'>
            <f:validator binding="#{row.bindings.ProgId.validator}"/>
        </af:inputText>
    </af:column>
    

    【讨论】:

    • 到目前为止的解决方案不错,但我认为 placeholder= 而不是 shortDesc= 将是 OP 首选的属性。
    • 你是对的@Selaron,为了更清楚,shortDesc 可用于显示 HINT: on focus,但要显示占位符,我们将使用占位符属性。
    • @AhmadMirza 我对答案的编辑刚刚被接受。
    猜你喜欢
    • 1970-01-01
    • 2013-01-09
    • 2016-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-07
    • 1970-01-01
    相关资源
    最近更新 更多