2014-11-05 82 views
0

我有一個PrimeFaces commandLink,它應該只是使某個區域可見。但是,我無法阻止它每次點擊時刷新頁面。我已經閱讀了一些關於它的主題,但它沒有幫助。如何阻止PrimeFaces p:commantLink重新加載頁面

<script type="text/javascript"> 
    function show() { 
     $("div[id*='models']").show(); 
    } 
</script> 
... 
<p:commandLink global="false" 
       onclick="show(); return null;"> 
    <h:outputText value="show..." /> 
    <f:ajax execute="@form" render="@none" /> 
</p:commandLink> 
<p:panel id="models" style="display:none"> Some content</p:panel> 

請問大家有什麼想法嗎?

回答

0

的例子,我就已經找到了自己的解決方案。

有primefaces JavaScript錯誤,我沒有看到

TypeError: this.visibleStateHolder is undefined 

增加可關閉=「true」以面板只是正常工作後!

1

添加和更新屬性,並列出要更新的組件,

<p:commandLink global="false" update="models" 
       onclick="show(); return null;"> 
    <h:outputText value="show..." /> 
    <f:ajax execute="@form" render="@none" /> 
</p:commandLink> 

你在展示http://www.primefaces.org/showcase/ui/button/commandLink.xhtml;jsessionid=h74zksrbt9hia24tk9nah5st

+0

我在路上試過這個,但它沒有改變任何東西。至少我的問題是其他問題。無論如何謝謝您的回答! – katja 2014-11-05 11:21:34

相關問題