2

Richfaces 4:我正在使用 rich:autoComplete 属性 showButton 为“true”,如下所示:

<rich:autocomplete mode="client" value="#{backingBean.selectedType}"
  autocompleteList= "#{backingBean.availableTypes}" 
  showButton="true">
</rich:autocomplete>

目前,它会在用户输入建议时显示过滤值。此外,单击按钮时,它仅显示过滤值。

无论用户在单击按钮时在 textBox 中输入了什么,我都需要显示可用类型的完整列表。但是,在文本框中输入应该过滤结果。这种行为早先出现在 Richfaces 3.3 组合框中,但不知何故,在 Richfaces 4 中,它似乎消失了。

请问有人知道如何实现这一目标吗?

4

1 回答 1

0

这是一个老问题,我认为 RF 4.5.2 会有更好的行为选择,但如果有人发现自己在 RF 4.3 中面临这个问题,我们可以通过修改 richfaces-components-ui- 中的 AutoComplete.js 来解决这个问题4.3.7.Final.jar:

rf.getDomElement(this.fieldId).focus();
if (this.isVisible) {
    this.__hide(event);
} else {
    var newItems = this.cache.getItems('', this.options.filterFunction);
    this.items = $(newItems);
    $(rf.getDomElement(this.id + 'Items')).empty().append(this.items);
    onShow.call(this, event);
}

else 子句的前三行是新的,当单击下拉按钮时会显示整个列表。否则,组件过滤的工作方式相同。(这是客户端模式。我没有尝试过其他选项。)

我在从源代码构建项目时遇到了麻烦,但为此只需要解压缩 jar 文件,替换 js,然后重新 jar 即可。

于 2015-01-14T15:11:44.277 回答