【发布时间】:2015-05-17 06:46:17
【问题描述】:
我正在尝试在 Xpage 中将 typeahead.js 功能与 bootstrap 3 一起使用。
我已将 Bootstrap 3 文件、jQuery2.4.3 和 typeahead.js 包含在数据库 (webContent) 中,并将它们作为资源与输入字段/编辑框一起包含,并为其分配了“typeahead”类。
我正在使用来自Mark Leusink 对另一个单独问题Xpages: TypeAhead with Bootstrap 的响应的示例。
在下面查看我的 Xpage 代码:
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" >
<xp:this.resources>
<xp:styleSheet href="/bootstrap/css/bootstrap.min.css"></xp:styleSheet>
<xp:styleSheet
href="/bootstrap/css/typeahead.js-bootstrap.css">
</xp:styleSheet>
<xp:script src="/jquery/jquery-2.1.4.js"
clientSide="true">
</xp:script>
<xp:script src="/bootstrap/js/bootstrap.js"
clientSide="true">
</xp:script>
<xp:script src="/jquery/x$.js"
clientSide="true">
</xp:script>
<xp:script src="/typeahead/typeahead.bundle.js"
clientSide="true">
</xp:script>
</xp:this.resources>
<xp:this.beforePageLoad>
<![CDATA[#{javascript:viewScope.put("typeaheadOptions", toJson(["Alabama", "Alaska"]));}]]>
</xp:this.beforePageLoad>
<xp:inputText id="inputText1" autocomplete="off"
styleClass="typeahead tt-query">
</xp:inputText>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[var value = #{viewScope.typeaheadOptions};
x$('inputText1').typeahead({source: value });
]]></xp:this.value>
</xp:scriptBlock>
</xp:view>
当我在输入字段中输入时,没有任何反应。我做错了什么?
谢谢
【问题讨论】:
-
客户端javascript控制台是否有任何错误消息?
-
我的猜测是 typeahead.js 使用 AMD。请参阅有关如何禁用 AMD 的答案:stackoverflow.com/a/26339718/785061
-
感谢@PerHenrikLausten 的回复我现在已经在 jquery.js 和 typeahead.js 中禁用了 AMD,但是我仍然没有得到任何结果。
-
谢谢@DavidLeedy。我没有收到任何错误消息 - 只有“主线程上的同步 XMLHttpRequest 已被弃用,因为它对最终用户的体验产生不利影响。有关更多帮助,请查看 xhr.spec.whatwg.org。”对于 dojo.js。这是我的问题吗??
-
我认为这不是你的问题。我在我的东西上看到了这些消息。
标签: jquery twitter-bootstrap-3 xpages lotus-domino typeahead.js