0

I've got a PrimeFaces commandLink which should just make some area visible. However i can not stop it refeshing the page each time it is clicked. I've read some topics about it already but it just does not help.

<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>

Does anymone have an idea, please?

katja
  • 1
  • 1
  • 3

2 Answers2

1

add and update attribute and list the components you want to update,

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

you have examples at showcase http://www.primefaces.org/showcase/ui/button/commandLink.xhtml;jsessionid=h74zksrbt9hia24tk9nah5st

Master Slave
  • 27,771
  • 4
  • 57
  • 55
  • I did try this one on my way but it did not change anything. At least my problem was somewere else. Thank you for answering anyway! – katja Nov 05 '14 at 11:21
0

I've just found the Solution myself.

There was primefaces javascript error that I did not see

TypeError: this.visibleStateHolder is undefined

After adding closable="true" to panel it works just fine!

katja
  • 1
  • 1
  • 3