验证失败后,Primefaces 3.4单元内可编辑表将输入文本单元标记为红色 [英] Primefaces 3.4 in-cell editable table marks inputtext-cell as red after failed validation
问题描述
我正在PF 3.4和Mojarra/Tomcat 7.0.29中使用单元内可编辑数据表.
I'm using a in-cell editable datatable in PF 3.4 with Mojarra/Tomcat 7.0.29.
我的问题是我正在对inputtext应用验证,效果很好.我唯一的问题是,验证失败后,该单元格将标记为红色.即使我关闭(即单击取消"按钮)可编辑模式,下一次我尝试进入编辑模式时它仍为红色.我需要在 之后关闭红色突出显示.
My problem is that I'm applying a validation on the inputtext which works great. The only issue I have is that after the validation fails, the cell is marked as red. Even if I close (i.e. click the cancel button) the editable-mode, it remains red next time I try to enter edit-mode. I need to have the red highlighting removed after I close the editable mode.
由于一切正常,这主要是一个装饰性问题.
Its mostly a cosmetic issue as everything is working fine.
有什么想法吗?
到目前为止,我已经在验证器中的组件上尝试过setValid(true)
,但似乎并没有太大帮助.
So far, I've tried setValid(true)
on the component in my validator but it does not seem to help much.
推荐答案
您需要的组件是
当验证失败时,输入组件将其局部值保持在状态. ResetInput用于从状态中清除缓存的值,以便组件可以从支持Bean模型中检索其值.
Input components keep their local values at state when validation fails. ResetInput is used to clear the cached values from state so that components retrieve their values from the backing bean model instead. 将重置输入组件附加到用于重置另一个组件状态的动作 Attach the reset input component to an action to reset another component state 另一种解决方案是使用PrimeFaces扩展中的 ResetInput 支持 An alternative solution would be using ResetInput from PrimeFaces Extensions which also support the 这篇关于验证失败后,Primefaces 3.4单元内可编辑表将输入文本单元标记为红色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
<p:commandButton ....>
<p:resetInput target="input1" />
</p:commandButton>
event
属性.这样,您可以像这样直接将rowEditCancel
与resetInput
连接:event
attribute. By this way you can directly connect your rowEditCancel
with the resetInput
like this:<p:ajax event="rowEditCancel"/>
<pe:resetInput event="rowEditCancel" for="input1"/>