相关疑难解决方法(0)

将jQuery添加到PrimeFaces导致所有地方都出现Uncaught TypeError

我正在使用PrimeFaces 3.5和JSF 2.0.我想使用jQuery插件,所以我在我的webapp中包含了jQuery.

<h:head>
    <h:outputScript name="js/jquery.min.js" />
    <h:outputScript name="js/jquery-ui.js" />
</h:head>
Run Code Online (Sandbox Code Playgroud)

但是,在使用PrimeFaces组件时,我会收到类似未捕获的类型错误:

未捕获的TypeError:无法读取未定义的属性"长度"

未捕获的TypeError:对象[object Object]没有方法'autocomplete'

未捕获的TypeError:无法读取未定义的属性'keyCode'

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

未捕获的TypeError:无法读取未定义的属性"LinearAxisRenderer"

未捕获的TypeError:对象[object Object]没有方法'fileupload'

未捕获的TypeError:this.jqEl.datetimepicker不是函数

等等.

这是怎么造成的,我该如何解决?

jquery jsf typeerror primefaces

11
推荐指数
1
解决办法
2万
查看次数

使用PrimeFaces图表中的jqPlot插件在图表上绘制线条

我想在PrimeFaces(v5.3)图表上绘制一些额外的行,特别是在线图上.查看jqPlot示例(PrimeFaces使用jqPlot绘制图表),此示例显示了我想要做的事情.

我使用了这个答案中描述的方法.

通过设置扩展程序,我可以运行自己的javascript函数,这允许我更改不同类型的配置.

创建模式时的Java:

private LineChartModel initLinearModel()
{
    LineChartModel model = new LineChartModel();
    model.setExtender("chartExtender");

    LineChartSeries series1 = new LineChartSeries();
    series1.setLabel("Series 1");
    series1.set(1, 2);
    series1.set(2, 1);
    series1.set(3, 3);
    series1.set(4, 6);
    series1.set(5, 8);

    model.addSeries(series1);

    return model;
}
Run Code Online (Sandbox Code Playgroud)

XHTML:

<?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:p="http://primefaces.org/ui">

<h:outputScript library="jqplot-plugin"
    name="jqplot.canvasOverlay.min.js" />
<h:outputScript library="js" name="extra_config.js" />

<h:head>
    <title>Chart</title>
</h:head>

<h:body>

    <p:chart type="line" model="#{primeChart.lineModel1}"
        style="height:300px;" />

</h:body>

</html>
Run Code Online (Sandbox Code Playgroud)

Javascript功能:

function chartExtender() {
    this.cfg.grid = …
Run Code Online (Sandbox Code Playgroud)

jqplot primefaces jsf-2

6
推荐指数
1
解决办法
2737
查看次数

如何解决与primefaces jquery的冲突

我正在使用primefaces 5开发一个项目,一个页面使用需要jquery的js文件,但显示Uncaught TypeError: undefined is not a function,但当我将我的jquery源更改<h:outputScript library="primefaces" name="jquery/jquery.js" target="head"/>

<h:head>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
</h:head>
Run Code Online (Sandbox Code Playgroud)

工作正常,但我失去了许多主要功能,如 contexMenu

我该如何解决这个冲突?

这是我的javascript文件:

(function($, $S) {
//$ jQuery
//$S window.localStorage
//Variables Declaration
var $board = $('#notesForm\\:board'),
//Board where the Posticks are sticked
Postick, //Singleton Object containing the Functions to work with the LocalStorage
len = 0, //Length of Objects in the LocalStorage
currentNotes = '', //Storage the html construction of the posticks
o; //Actual Postick data …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jsf primefaces jsf-2

5
推荐指数
1
解决办法
3万
查看次数

标签 统计

primefaces ×3

jquery ×2

jsf ×2

jsf-2 ×2

javascript ×1

jqplot ×1

typeerror ×1