Primefaces Dialog Framework - Not Working

5.9k Views Asked by At

Primefaces Dialog Framework v 4 is not working, I have googled to solve the problem as I have added the following code to faces config but all went in vain. Please find the code below:

Index page:

<p:commandButton value="View" icon="ui-icon-extlink" actionListener="#{dialogBean.viewCars}" /> 

Bean Code:

 public void viewCars() {  
    RequestContext.getCurrentInstance().openDialog("viewCars");  
} 

faces config:

<application>   <action-listener>org.primefaces.application.DialogActionListener</action-listener>
<navigation-handler>org.primefaces.application.DialogNavigationHandler</navigation-handler>
<view-handler>org.primefaces.application.DialogViewHandler</view-handler></application>

TypeError: this.jq.draggable is not a function in /faces/javax.faces.resource/primefaces.js?ln=primefaces&v=4.0 enter image description here

How to solve the issue?

1

There are 1 best solutions below

0
On

As Cagatay Civici said you must add to the header of your page this line:

<h:outputScript name="jquery/jquery-plugins.js" library="primefaces"/>

Don't worry - do not copy any files to your project - above line is enough because PrimeFaces automatically adds js file.

But you must also add few lines to your faces-config.xml file:

<application>
  <action-listener>org.primefaces.application.DialogActionListener</action-listener>
  <navigation-handler>org.primefaces.application.DialogNavigationHandler</navigation-handler>
  <view-handler>org.primefaces.application.DialogViewHandler</view-handler>
</application>

You may also read this article of Laura Liparulo.