2013-09-23 22 views
1

我使用了iceface的selectInputDate。在.jspx文件中的代碼如下:icefaces selectinputdate value

<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空值,然後面板打開,並在用戶(我在這種情況下)工作,並關閉面板後,我再次將空值設置爲MDate。但後來我再次打開面板,通過日曆選擇的最後一個值被保存並自動填入。我該如何解決這個問題?謝謝。

回答

1

當您關閉面板時,您的selectInputDate組件不會在頁面上重繪,然後返回舊值。例如,可以使用'rendered = true/false'屬性來顯示/隱藏父面板。

對於修復,而不是使用「渲染」 visibled'屬性或明確的價值在selectInputDate組件直接使用結合

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> 
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); 
} 

這將重置彈出的是這段代碼執行州。