2014-06-13 27 views
0

我有一個數據表,每行一個命令按鈕時,Primefaces對話框關閉稱爲第二次

的問題是,當我需要打開一個對話框,第一個,然後點擊另一按鈕,我需要更新它。問題是當我點擊第二個按鈕時,它關閉對話框,用戶必須再次點擊第二個按鈕才能再次打開對話框!

感謝在您的幫助,

我在這裏進一步解釋

回答

0

我knowldege,只要你想你可以打開多個對話框,只有確保你給他們一個獨特的widgetVar ID:

<p:dialog widgetVar="dlg1"> 
    <h:outputText value="Hello from first dialog"/> 
</p:dialog> 
<p:dialog widgetVar="dlg2"> 
    <h:outputText value="Hello from second dialog"/> 
</p:dialog> 

...

<p:commandButton value="Open First" onclick="dlg1.show()"/> 
<p:commandButton value="Open Second" onclick="dlg2.show()"/> 

點擊次上面的e commandButton將並行打開兩個單獨的對話框。

0

我認爲你的按鈕對整個Naming Container進行了更新,包裝Dialog。如果你這樣做,那就是你得到的。

你應該在你的Dialog裏面更新Container,裏面包裝了你的組件。

例子:
別:

<h:panelGrid id="gridContainer"> 
    <p:dialog id="dialogComponent> 

    // components 

    </p:dialog> 
</h:panelGrid> 

<p:commandButton update="#{p:component('gridContainer')}"/> 

務必:

<h:panelGrid id="gridContainer"> 
    <p:dialog id="dialogComponent> 

    <h:panelGrid id="insideContainer"> 
     // components 
    </h:panelGrid> 

    </p:dialog> 
</h:panelGrid> 

<p:commandButton update="#{p:component('insideContainer')}"/> 

我覺得你的想法。
希望它有幫助。

相關問題