JSF h:outputScript排序和PrimeFaces jQuery [英] JSF h:outputScript ordering and PrimeFaces jQuery

查看:92
本文介绍了JSF h:outputScript排序和PrimeFaces jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用( Primefaces with TwitterBootstrap )。目前DropDown菜单无法使用,例如a p:dataTable 存在。我已经想通了,如果我在中有以下订单,它正在工作(没有任何Primefaces组件)h:head

I want to use (Primefaces with TwitterBootstrap). Currently the DropDown menu it's not working if e.g. a p:dataTable is present. I've figured out, that it's working (without any Primefaces components) if I have the following ordering in h:head:

<h:head>
  <h:outputScript library="js" name="bootstrap.js"/>
  <h:outputScript library="primefaces" name="jquery/jquery.js"/>
  ...
</h:head>

如果我交换排序(首先是jquery.js,而不是bootstrap.js),DropDown菜单是破碎。我的问题是,在渲染的HTML输出中使用PrimeFaces组件时,PrimeFaces使用的脚本(jquery.js和primefaces.js)总是在 h:head

If I swap the ordering (first jquery.js, than bootstrap.js), the DropDown menu is broken. My problem is, that with the usage of PrimeFaces components in the rendered HTML output the scripts used by PrimeFaces (jquery.js and primefaces.js) are always before manual entries in h:head.

<script src="/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces"></script>
<script src="/javax.faces.resource/primefaces.js.jsf?ln=primefaces"></script>
<script src="/javax.faces.resource/bootstrap.js.jsf?ln=js"></script>

如何导入 bootstrap.js 之前 jquery.js

推荐答案

如果问题与包含有关您的资源顺序,您应该看看PrimeFaces团队的以下博客文章:可定制的资源订购

If the problem is related to the include order of your resources, you should have a look at the following blog post of the PrimeFaces team: Customizable Resource Ordering.

您可以在 h:head中定义第一个 facet 元素。放置在那里的元素将在PrimeFaces资源之前加载。

You can define a first facet inside your h:head element. Elements placed there will be loaded before the PrimeFaces resources.

<h:head>
    <f:facet name="first">
        <h:outputScript library="js" name="bootstrap.js"/>
    </f:facet>
</h:head>

这篇关于JSF h:outputScript排序和PrimeFaces jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆