Primefaces Dialog Framework - Not Working

2019-07-20 22:24发布

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条回答
Lonely孤独者°
2楼-- · 2019-07-20 22:48

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.

查看更多
登录 后发表回答