我正在尝试制作一个自定义的自动完成框,但我遇到了一些麻烦。现在我有一个在 keydown 上调用这个函数的输入
function pingAutoComplete(event)
{
console.log("pingAutoComlete Called");
window.clearTimeout(window.keyTimeout);
//Wait 2 seconds before we attempt to pingAutoComplete incase user has not finished typing
window.keyTimeout = setTimeout(function() {
jsf.ajax.request(event, "keydown", {execute:'searchTerm',render:'autoCompletePanel'})
autoCompleteLayoutPanel.show();
return false;
}, 2000);
return false;
}
自动完成面板包含一堆看起来像这样的选择
<h:selectOneListbox id="vehicleResult" title="Vehicles"
value="#{searchBean.searchTerm}"
converter="entityConverter"
required="false"
rendered="#{!searchBean.filterAutoComplete().isEmpty()}">
<f:selectItems value="#{searchBean.filterAutoComplete()}"
var="searchItem" itemValue="#{searchItem}"
itemLabel="#{searchItem.displayString}"
itemLabelEscaped="true" />
</h:selectOneListbox>
现在,当调用 javascript 时,它似乎在后端点击 searchBean.filterAutoComplete(),但实际上并没有更新 gui 中的选择列表。有谁知道为什么?