0

我在对话框中使用自动完成。问题是自动完成没有正确显示。图像会最好地描述它,所以它是这样的:

在此处输入图像描述

如您所见,自动完成功能并不完全可见,并且滚动条出现在右侧。我想要实现的是自动完成将在没有滚动条的情况下完全可见。这就是我想要实现的目标:

在此处输入图像描述

这是示例代码(原始应用程序代码太复杂,所以我创建了以相同方式工作的演示应用程序):

索引.xhtml

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:ice="http://www.icesoft.com/icefaces/component"
    xmlns:ace="http://www.icefaces.org/icefaces/components"
    xmlns:iscecore="http://www.icefaces.org/icefaces/core">
<h:head>
    <title>Insert title here</title>
    <ice:outputStyle href="./xmlhttp/css/xp/xp.css" rel="stylesheet"
        type="text/css" />
</h:head>
<h:body>
    <h:commandButton id="show" value="Show Dialog" onclick="sampleDialog.show();"/>
    <ace:dialog id="dialogId" header="Dialog example"
        widgetVar="sampleDialog" draggable="true" modal="true">
        <h:outputText value="dialog content"></h:outputText>
        <h:form id="autoCompleteForm">
            <ace:dialog id="dialogId" header="Dialog example"
                widgetVar="sampleDialog" draggable="true" modal="true">
                <h:outputText value="dialog content"></h:outputText>
            </ace:dialog>
            <ace:autoCompleteEntry id="componentId" rows="10" width="150"
                value="#{autoCompleteEntryBean.selectedText}"
                filterMatchMode="startsWith" label="Select city:">
                <f:selectItems value="#{autoCompleteEntryBean.cities}" />
            </ace:autoCompleteEntry>
        </h:form>
    </ace:dialog>
</h:body>
</html>

AutoCompleteEntryBean.java

package icefacesAutocompleteProblem;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.model.SelectItem;

@ManagedBean
@ViewScoped
public class AutoCompleteEntryBean {

    private String selectedText;
    private List<SelectItem> cities;

    @PostConstruct
    public void init() {
        cities = new ArrayList<SelectItem>();
        cities.add(new SelectItem("Warsaw"));
        cities.add(new SelectItem("Warsaw1"));
        cities.add(new SelectItem("Warsaw2"));
        cities.add(new SelectItem("Warsaw3"));
        cities.add(new SelectItem("Warsaw4"));
        cities.add(new SelectItem("Warsaw5"));
        cities.add(new SelectItem("Warsaw6"));
        cities.add(new SelectItem("Warsaw7"));
        cities.add(new SelectItem("Warsaw8"));
        cities.add(new SelectItem("Warsaw9"));
        cities.add(new SelectItem("Warsaw10"));
        cities.add(new SelectItem("Warsaw11"));
        cities.add(new SelectItem("Warsaw12"));
    }

    public String getSelectedText() {
        return selectedText;
    }

    public void setSelectedText(String selectedText) {
        this.selectedText = selectedText;
    }

    public List<SelectItem> getCities() {
        return cities;
    }

}
4

1 回答 1

1

Problem solved by setting overflow: visible; for ace:dialog and it's content (div[id$='_main']).

于 2013-10-14T07:38:30.580 回答