我使用iceface的selectInputDate。 .jspx文件中的代码如下:
<ice:selectInputDate id="Dt"
value="#{actionsBean.MDate}"
renderAsPopup="true" required="true"
partialSubmit = "true"
popupDateFormat="#{msgs.date_format}"
valueChangeListener = "#{actionsBean.mDateChangeListener}">
<f:converter converterId="MDateConverter" /> </ice:selectInputDate>
问题实际上是:我希望输入中的值默认为空字符串。我设置为MDate null值,然后面板打开,在用户(我在这种情况下)工作和关闭面板后,我再次将空值设置为MDate。但是我再次打开面板,通过日历选择的最后一个值被保存并自动填写。我该如何解决这个问题?谢谢。
答案 0 :(得分:1)
关闭面板时,selectInputDate组件不会在页面上重绘,然后返回旧值。例如,如果您使用'rendered = true / false'属性来显示/隐藏父面板,则可以是这样。
对于修复,使用'visibled'属性而不是'rendered'或直接在selectInputDate组件中使用绑定来获取clear值
答案 1 :(得分:0)
您实际上可以将valueChangeListener
替换为f:ajax
侦听器并尝试查看差异。
<h:form id="dateForm">
....
<ice:selectInputDate id="Dt"
value="#{actionsBean.MDate}"
renderAsPopup="true" required="true"
partialSubmit = "true"
popupDateFormat="#{msgs.date_format}">
<f:converter converterId="MDateConverter" />
<f:ajax execute="@this" render="@form"
listener = "#{actionsBean.mDateChangeListener}">
</ice:selectInputDate>
...
</h:form>
答案 2 :(得分:0)
这可能是由于icefaces弹出面板的问题引起的,我尝试的是每次弹出窗口关闭时都会执行此代码(隐藏)::
public void clearSubmittedValues() {
final FacesContext context = FacesContext.getCurrentInstance();
final Application application = context.getApplication();
final ViewHandler viewHandler = application.getViewHandler();
final UIViewRoot viewRoot = viewHandler.createView(context, context.getViewRoot().getViewId());
context.setViewRoot(viewRoot);
}
这将重置弹出窗口的状态。