0

I want to open a pop-up on command link panel but it doesn't opens the pop-up but renders it afterwards.

<h:commandLink onclick="{#{rich:component('viewPopupPanel')}.show();}" value="View">
    <f:ajax execute="dat1" render=":viewForm:viewPopupPanel" listener="#{listingBean.viewAction(data)}"/>
</h:commandLink> 

In my backing bean i am setting the data that is passed through the function but since render gets called after the onCLick event is called i want to delegate the on Click event after the ajax request is completed. How to achieve that?

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Ankit Duggal
  • 55
  • 2
  • 13

1 Answers1

0

You can use onevent attribute in f:ajax tag as follow

<h:commandLink value="View">
  <f:ajax execute="dat1" render=":viewForm:viewPopupPanel" listener="#{listingBean.viewAction(data)}" onevent="showPopup"/>
</h:commandLink>

and define the showPopup java script function as follow :

<script>
function showPopup(data){
  if (data.status == "success") {
    #{rich:component('viewPopupPanel')}.show();
    }
}
</script>
Ahmed
  • 131
  • 1
  • 2
  • 6