< p:autoComplete>未捕获的TypeError:无法读取未定义的属性'keyCode' [英] <p:autoComplete> Uncaught TypeError: Cannot read property 'keyCode' of undefined
本文介绍了< p:autoComplete>未捕获的TypeError:无法读取未定义的属性'keyCode'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用PrimeFaces 5.1的<p:autocomplete />
,但是由于某些原因,当我加载页面时,在浏览器控制台上收到以下消息:
I'm trying to use the <p:autocomplete />
of PrimeFaces 5.1, but for some reason when I load the page I receive the folowing message on the browsers console:
未捕获的TypeError:无法读取未定义的属性'keyCode'
Uncaught TypeError: Cannot read property 'keyCode' of undefined
我的看法是这样的:
<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:outputScript library="primefaces" name="jquery/jquery.js"/>
<h:outputScript library="primefaces" name="jquery/jquery-plugins.js"/>
<ui:composition>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<p:link outcome="index" value="Chamada Parlamentar" styleClass="navbar-brand header-link" />
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li>
<p:link href="https://github.com/Thiagokairala/reconstru-oChamadaParlametnar">
<h:outputText value="Código Fonte:" />
<p:graphicImage url="/images/github.png" />
</p:link>
</li>
<li>
<p:link href="http://dados.gov.br/dados-abertos/">
<h:outputText value="Lei dos Dados Abertos" />
</p:link>
</li>
<li>
<p:link outcome="about" value="Nós" />
</li>
<li>
<p:link outcome="help" value="Ajuda" />
</li>
</ul>
<h:form class="navbar-form navbar-right" onsubmit="#{deputyMB.statistics}">
<p:autoComplete value="#{deputyMB.deputyName}"
completeMethod="#{autoComplete.completeDeputies}" />
</h:form>
</div>
</div>
</div>
</ui:composition>
我的自动完成方法是这样的:
My auto complete method is like this:
package jsfConnection;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class AutoComplete {
public List<String> completeDeputies(String prefix) {
List<String> deputies = new ArrayList<String>();
for (int i = 0; i < 10; i++) {
deputies.add(Integer.toString(i));
}
return deputies;
}
}
这是怎么引起的,我该如何解决?
How is this caused and how can I solve it?
推荐答案
我已修复,这是一个简单的jQuery限制.
I fixed, it was a simple jquery conflit.
这篇关于< p:autoComplete>未捕获的TypeError:无法读取未定义的属性'keyCode'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文