简体   繁体   English

Vaadin 8 当组件中的值发生变化时窗口回滚到开头

[英]Vaadin 8 the window is rolled back to the beginning when the value in the component changes

In my application, I need a pop-up window with a lot of content that does not fit completely into the browser window and has a scroll bar.在我的应用程序中,我需要一个弹出窗口,其中包含许多无法完全放入浏览器窗口并带有滚动条的内容。 I have already tried to show a pop-up window using Browser Window Opener, but ran into the following problem ( enter link description here ).我已经尝试使用 Browser Window Opener 显示一个弹出窗口,但遇到了以下问题( 在此处输入链接描述)。 Following the advice suggested in the comments, I changed Browser Window Opener to Window in modal mode.按照评论中建议的建议,我将 Browser Window Opener 更改为 Window in modal mode。

The resulting main view:由此产生的主视图:

在此处输入图片说明

And modal view:和模态视图:

在此处输入图片说明

The modal window contains 200 TextFields.模态窗口包含 200 个文本字段。 At first glance, everything looks good, but if I scroll the window down and try to enter data, for example, in a field 22, then the scroll wheel is unwound to the beginning of the window:乍一看,一切看起来都不错,但是如果我向下滚动窗口并尝试输入数据,例如,在字段 22 中,那么滚轮将展开到窗口的开头:

在此处输入图片说明

The code for add window:添加窗口的代码:

button.addClickListener(e -> { TestForm subForm = new TestForm(); button.addClickListener(e -> { TestForm subForm = new TestForm();

        Window subWindow = new Window("460006801");
        subWindow.setContent(subForm);
        subWindow.center();
        subWindow.setModal(true);

        UI.getCurrent().addWindow(subWindow);
    });

TestForm:测试表格:

public class TestForm extends FormLayout implements Serializable{
    public Button save = new Button("Save");

    public TestForm() {
        for(int i = 0; i < 200; i++) {
            TextField textField = new TextField("field " + i);
            addComponent(textField);
        }
    }

    public void saveConfigs() {
        System.out.print("Save ");
    }
}

What I really need is of course that when changing the value in the text box, the focus on the page stays in the same place instead of scrolling to the beginning.当然,我真正需要的是,在更改文本框中的值时,页面上的焦点会停留在同一位置,而不是滚动到开头。

The problem is the same as that presented by the link the problem问题与问题链接提出的问题相同

The solution is to set the "height" parameter to 100%解决方法是将“height”参数设置为100%

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM