当我调用jquery代码时,p:对话框不起作用

时间:2015-09-22 23:53:55

标签: jsf primefaces dialog

当我调用jquery代码(jquery.js,plugin.js)时,PrimeFaces <p:dialog>不起作用,但是当我不调用它的jquery代码时,我需要两者。我收到这个错误:

  

未捕获的TypeError:this.jq.draggable不是函数

我的页面:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">
<h:head>

    <!-- ============================================
        Stylesheets
    ============================================= -->
    <link rel="stylesheet" href="../template/style.css" type="text/css" />
    <link rel="stylesheet" href="../template/css/tipsy.css" type="text/css" />
    <link rel="stylesheet" href="../template/css/bootstrap.css"
        type="text/css" />
    <link rel="stylesheet" href="../template/css/font-awesome.css"
        type="text/css" />
    <link rel="stylesheet" href="../template/css/prettyPhoto.css"
        type="text/css" />
    <link rel="stylesheet" href="../template/css/rs/css/rs-settings.css"
        type="text/css" />
    <link rel="stylesheet" href="../template/css/responsive.css"
        type="text/css" />
    <meta name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1" />

    <!-- ============================================
        External JavaScripts
    ============================================= -->
    <script type="text/javascript" src="../template/js/jquery.js"></script>
    <script type="text/javascript" src="../template/js/plugins.js"></script>
    <!-- ============================================
        Document Title
    ============================================= -->
    <title>BJ</title>
</h:head>
<h:body>
    <div id="wrapper" class="clearfix">
        <div id="top-bar">
            <div class="container clearfix"></div>
        </div>
        <div id="header">
            <div class="container clearfix">
                <div id="logo">
                    <a href="index.php"><img src="../template/images/logo.png"
                        alt="CoWorker" title="CoWorker" /></a>
                </div>
                <div id="primary-menu">
                    <ul>
                        <li class="current"><a href="index.php"><div>Home</div> <span>Let's
                                    Start here</span></a>
                            <ul>
                                <li><a href="#"><div>Sliders</div></a>
                                    <ul>
                                        <li><a href="index-layer.php"><div>Layer Slider</div></a></li>
                                    </ul></li>
                            </ul></li>
                    </ul>
                </div>
            </div>
        </div>
        <div id="content">
            <div class="content-wrap">
                <div class="container clearfix">

                    <h:form>



                        <p:commandButton value="ADD" action="#{patientBean.create}">
                        </p:commandButton>

                        <p:outputPanel>

                            <p:dataTable var="patient" value="#{patientBean.listPatient}"
                                widgetVar="carsTable"
                                emptyMessage="No datas found with given criteria"
                                filteredValue="#{patientBean.filtredListPatient}" reflow="true"
                                rows="1" paginator="true" rendered="true">

                                <f:facet name="header">
                                    <p:outputPanel>
                                        <h:outputText value="Search all fields:" />
                                        <p:inputText id="globalFilter"
                                            onkeyup="PF('carsTable').filter()" style="width:150px"
                                            placeholder="Enter keyword" />
                                    </p:outputPanel>
                                </f:facet>

                                <p:column filterBy="#{patient.cin}" headerText="cin"
                                    filterMatchMode="contains" sortBy="#{patient.cin}">
                                    <h:outputText value="#{patient.cin}" />
                                </p:column>
                                <p:column filterBy="#{patient.nom}" headerText="nom"
                                    filterMatchMode="contains" sortBy="#{patient.nom}">
                                    <h:outputText value="#{patient.nom}" />
                                </p:column>
                                <p:column filterBy="#{patient.prenom}" headerText="prenom"
                                    filterMatchMode="contains" sortBy="#{patient.prenom}">
                                    <h:outputText value="#{patient.prenom}" />
                                </p:column>
                                <p:column headerText="Actions">
                                    <p:outputPanel>

                                        <p:commandButton value="EDIT" action="#{patientBean.getRow()}"
                                            oncomplete="PF('popEditPatient').show();">
                                        </p:commandButton>

                                        <p:commandButton action="#{patientBean.delete}" value="DELETE">
                                        </p:commandButton>
                                    </p:outputPanel>
                                </p:column>
                            </p:dataTable>
                        </p:outputPanel>
                    </h:form>
                </div>
            </div>

        </div>
    </div>
    <div class="clear"></div>
    <div id="copyrights" class="copyrights-dark">
        <div class="container clearfix">
            <div class="col_half">Created by JALLOULI Bilel</div>
        </div>
    </div>
    <div id="gotoTop" class="icon-angle-up"></div>
    <script type="text/javascript" src="../template/js/custom.js"></script>

    <p:dialog widgetVar="popEditPatient" modal="true" header="EDIT">
        <p:outputPanel autoUpdate="true">
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="cin :" />
                    <p:inputText id="cin" value="#{patientBean.patient.cin}"
                        disabled="true" />


                    <h:outputLabel value="nom :" />
                    <p:inputText id="nom" value="#{patientBean.patient.nom}" />

                    <h:outputLabel value="prenom :" />
                    <p:inputText id="prenom" value="#{patientBean.patient.prenom}" />

                </h:panelGrid>

                <p:commandButton value="Ok" action="#{patientBean.save}"
                    oncomplete="if (!args.validationFailed) PF('popEditPatient').hide();" />
                <p:commandButton value="Annuler" action="#{patientBean.init}"
                    oncomplete="PF('popEditPatient').hide();" />
            </h:form>
        </p:outputPanel>
    </p:dialog>
</h:body>
</html>

faceconfig:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
 version="2.2">
  <converter>
  <converter-id>entitySelectItemsConverter</converter-id>
  <converter-class>tn.com.bj.presentation.tools.EntitySelectItemsConverter</converter-class>
 </converter>
<!--  
 <navigation-rule>
  <from-view-id>/views/listPatient.xhtml</from-view-id>
  <navigation-case>
   <from-outcome>listePatient</from-outcome>
   <to-view-id>/views/listPatient.xhtml</to-view-id>
   <redirect/>
  </navigation-case>
 </navigation-rule>
-->

 <!-- JSF and Spring are integrated -->
 <application>
  <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
 </application>
</faces-config>

0 个答案:

没有答案