2013-08-28 49 views
0

我正在使用Primefaces 3.5。我有以下代碼:SelectOneMenu更改時PrimeFaces更新庫

<p:panel id="containerSelectionPanel" header="Container Selection"> 
    <h:form id="containerSelectionForm"> 
     <p:selectOneMenu value="#{manageContainersBean.selectedContainer}"> 
      <f:selectItems value="#{manageContainersBean.containerList}" var="container" itemLabel="#{container.name}" /> 
      <p:ajax update=":componentSelectionPanel" /> 
     </p:selectOneMenu> 
    </h:form> 
</p:panel> 

<p:panel id="componentSelectionPanel" header="Component Selection"> 
    <h:form id="componentSelectionForm"> 
     <p:galleria id="componentGallery" var="component" 
      value="#{manageContainersBean.selectedContainer.components}"> 
      <p:graphicImage value="#{component.preview}" title="#{component.name}" alt="#{component.name}"></p:graphicImage> 
     </p:galleria> 
    </h:form> 
</p:panel> 

在網站的啓動畫廊得到正確顯示。但是,如果我更改了SelectOneMenu中的選擇 ,則該庫僅爲空(沒有任何顯示,「組件選擇」面板本身爲空)。

通過AJAX請求進行更新的作品。更新時檢索組件列表,根據需要預覽以及名稱。但是,更新的畫廊生成的HTML代碼中含有非常少的線,這樣小於最初加載庫的時候,在這裏看到:

<ul class="ui-galleria-panel-wrapper"> 
    <li class="ui-galleria-panel ui-helper-hidden"> 
     <img id="j_idt28" alt="Have lunch" title="Have lunch"> 
    </li> 
    <li class="ui-galleria-panel ui-helper-hidden"> 
     <img id="j_idt28" alt="Have brunch" title="Have brunch"> 
    </li> 
</ul> 

可以看出,新選擇的容器被取出,但和圖像有些更新(但inital畫廊包含更多的代碼)。

我已經嘗試更新完整的窗體而不是隻有畫廊:相同的結果。我嘗試從畫面本身移出畫廊:結果相同。我嘗試使用瀏覽器控制檯的Javascript更新,如試用here,沒有任何反應。

有人有解決這個問題的辦法嗎?

更新:我檢查了服務器響應,當應該更新庫時發送。它包含與初始響應完全相同的代碼(當圖庫工作時),所以在呈現響應期間JSF肯定會出現問題。但仍然不知道如何處理這個問題。

編輯:一般事情:表格不應該更新,而是完整的面板。

問候, bobbel

回答

0

我發現所報告here問題。

臨時溶液,然後是修改AJAX請求在containerSelectionForm如下:

<p:ajax 
    update=":componentSelectionPanel"   
    oncomplete="PrimeFaces.cw('Galleria','widget_componentSelectionForm_componentGallery',{id:'componentSelectionForm:componentGallery'}" /> 

PrimeFaces.cw()呼叫一定要包括拱廊參數,如在對象panelWidth,已經含有id

+0

不工作.... –

+0

@IrfanNasim:可能是,PF是一個瘋狂的,不穩定的世界。不幸的是我已經很久沒有和Java一起工作了,所以我在這裏幫不了你。如果您認爲應該刪除接受或者您知道如何解決它,請告訴我。但是,也可能只是在您的特定環境中,它不起作用,或者僅僅在我的具體環境中起作用。很難說。 – bobbel