2012-11-19 33 views
1

我遇到的問題是與主要面孔日曆輸入字段。 在你的時刻,我使用彈出式按鈕可以正常工作。所以你點擊按鈕,出現日曆,所以你可以選擇一個日期。然而,我正在處理的頁面所需的影響是,當輸入字段具有焦點時,日曆將顯示。Primefaces日曆只適用於彈出式按鈕

關於Primesfaces Calendar Showcase我正在查找的功能顯示在標有「Popup」的示例中。

從網站上的例子我可能天真地認爲,我必須做的所有改變從按鈕到焦點激活的日曆是刪除showOn =「button」屬性。

前:

    <p:calendar id="fldDateOfBirth" 
        value="#{pc_CreatePatient.patient.dateOfBirth}" 
        binding="#{pc_CreatePatient.dobComp}" navigator="true" 
        display="inline" pattern="dd/mm/yyyy" yearRange="-100" 
        title="#{msg.user_date_format_default_tip}" showOn="button" /> 

後:

    <p:calendar id="fldDateOfBirth" 
        value="#{pc_CreatePatient.patient.dateOfBirth}" 
        binding="#{pc_CreatePatient.dobComp}" navigator="true" 
        display="inline" pattern="dd/mm/yyyy" yearRange="-100" 
        title="#{msg.user_date_format_default_tip}"/> 



進行更改後的portlet完全不渲染和日誌持有以下錯誤信息:

[11/19/12 18:47:30:942 GMT] 00000043 RpmMaintainUs E RpmExceptionHandler handle Throwable=>class java.lang.IllegalArgumentException<==>component identifier must not be a zero-length Stringnent identifier must not be a zero-length Stringcomponent identifier must not be a zero-length String 

非常感謝您提供任何他用這個。

+0

你正在運行什麼版本?另外,你是否嘗試過使用bean上的簡單屬性?這可能是一個僞裝的NPE。 –

回答

0

我發現,解決我的問題是,來標記日曆輸入字段沒有你需要刪除一些屬性的按鈕。我原本以爲你只需要刪除'showOn =「按鈕」',但我也必須刪除'display =「inline」'才能使它工作。最終標記下面:

    <p:calendar id="fldDateOfBirth" 
        value="#{pc_CreatePatient.patient.dateOfBirth}" 
        binding="#{pc_CreatePatient.dobComp}" navigator="true" 
        pattern="dd/mm/yyyy" yearRange="-100" 
        title="#{msg.user_date_format_default_tip}"/> 

我意識到這可能是一個菜鳥的問題,但我不得不說,我沒有找到primefaces網站在實際執行中有些是非常有幫助的玩具。如果任何人有任何有關Primefaces庫的良好網站或教程,請添加評論。

1

您應該使用這一點,它會工作得很好:

<p:calendar id="fldDateOfBirth" 
value="#{pc_CreatePatient.patient.dateOfBirth}" 
title="#{msg.user_date_format_default_tip}"/> 

選定的日期將在您的彈出行顯示。 如果你想使用選定的日期在別的地方:

<h:outputText value="Popup Date:" /> 
      <h:outputText value="#{pc_CreatePatient.patient.dateOfBirth}" id="popupDate"> 
       <f:convertDateTime pattern="d/M/yyyy"/> 
      </h:outputText>