JSF h:outputScript排序和PrimeFaces jQuery [英] JSF h:outputScript ordering and 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 $ c $中的手动输入之前。 c>。
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中定义
元素。放置在那里的元素将在PrimeFaces资源之前加载。第一个
facet
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屋!