【问题标题】:How to make all dataTable columns inputs readOnly如何使所有 dataTable 列输入只读
【发布时间】:2017-05-05 14:58:33
【问题描述】:

我有一个 <p:datable><p:column> ,在每一列内我都有一个 <p:inputTex>.. 我想知道是否有一种方法可以使所有这些<p:inputTex> 只读而无需手动进行(每个<p:inputTex> 的readOnly="true"),因为我有很多列..

提前致谢

【问题讨论】:

    标签: primefaces jsf-2 jsf-2.2


    【解决方案1】:

    OnmiFaces massAttribute 是专门为此设计的。

    来自他们的展示(稍微适应了这种情况):

    <o:massAttribute name="readonly" value="#{formBean.shouldBeReadonly}" target="javax.faces.component.UIInput">
        <h:outputLabel for="input1" />
        <h:inputText id="input1" />
        <h:outputLabel for="input2" />
        <h:inputText id="input2" />
        <h:outputLabel for="input3" />
        <h:inputText id="input3" />
    </o:massAttribute>
    

    target 属性是为了确保只有输入组件是,嗯...目标,而不是输出或其他组件。您还可以使用 'true' 的静态 value,而不是在 bean 中引用 getter。

    【讨论】:

    • 谢谢@Kukeltje,我明白了,你知道如何在我的 上应用这个
    • 尝试将它包裹在 p:datatable... 我认为它可以递归工作...
    猜你喜欢
    • 2017-04-13
    • 2014-05-02
    • 2013-07-23
    • 1970-01-01
    • 2011-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多