<i id='PuvAL'><tr id='PuvAL'><dt id='PuvAL'><q id='PuvAL'><span id='PuvAL'><b id='PuvAL'><form id='PuvAL'><ins id='PuvAL'></ins><ul id='PuvAL'></ul><sub id='PuvAL'></sub></form><legend id='PuvAL'></legend><bdo id='PuvAL'><pre id='PuvAL'><center id='PuvAL'></center></pre></bdo></b><th id='PuvAL'></th></span></q></dt></tr></i><div id='PuvAL'><tfoot id='PuvAL'></tfoot><dl id='PuvAL'><fieldset id='PuvAL'></fieldset></dl></div>
      <bdo id='PuvAL'></bdo><ul id='PuvAL'></ul>
    <legend id='PuvAL'><style id='PuvAL'><dir id='PuvAL'><q id='PuvAL'></q></dir></style></legend>

  • <tfoot id='PuvAL'></tfoot>

        <small id='PuvAL'></small><noframes id='PuvAL'>

      1. 如何在 vaadin-flow 中正确指定对话框大小

        时间:2023-06-27

          <small id='YC9wg'></small><noframes id='YC9wg'>

          • <legend id='YC9wg'><style id='YC9wg'><dir id='YC9wg'><q id='YC9wg'></q></dir></style></legend>

                <tfoot id='YC9wg'></tfoot>
                • <bdo id='YC9wg'></bdo><ul id='YC9wg'></ul>

                    <tbody id='YC9wg'></tbody>
                  <i id='YC9wg'><tr id='YC9wg'><dt id='YC9wg'><q id='YC9wg'><span id='YC9wg'><b id='YC9wg'><form id='YC9wg'><ins id='YC9wg'></ins><ul id='YC9wg'></ul><sub id='YC9wg'></sub></form><legend id='YC9wg'></legend><bdo id='YC9wg'><pre id='YC9wg'><center id='YC9wg'></center></pre></bdo></b><th id='YC9wg'></th></span></q></dt></tr></i><div id='YC9wg'><tfoot id='YC9wg'></tfoot><dl id='YC9wg'><fieldset id='YC9wg'></fieldset></dl></div>
                  本文介绍了如何在 vaadin-flow 中正确指定对话框大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  试图从包含按钮的网格渲染器中打开一个对话框.问题是对话框不遵守指定的大小.

                  Trying to open a dialog from a grid renderer which contain a button. The problem is that the dialog isn't respecting the specified size.

                  我尝试设置对话框的宽度和高度,但它不会影响 DOM 元素,只会影响它的子元素(看起来不像预期的那样)

                  I've tried setting the width and height of the dialog but it doesn't affect the DOM element only its childs (which doesn't look as expected)

                      @Override
                      public VerticalLayout createComponent(P item) {
                                  // this simply create a VerticalLayout
                          VerticalLayout layout = super.createComponent(item);
                  
                          HorizontalLayout subLayout = new HorizontalLayout();
                          subLayout.setWidthFull();
                          subLayout.setDefaultVerticalComponentAlignment(Alignment.CENTER);
                  
                          this.button = new MSButton(this.colorClass, this.vaadinIcon);
                          this.button.addClickListener(event -> {
                              this.parent = item;
                              this.grid.getDataProvider().refreshAll();
                              this.dialog.open();
                          });
                  
                          subLayout.add(this.button);
                          layout.add(subLayout);
                  
                          return layout;
                      }
                  
                      private void constructDialog() {
                          this.dialog = new Dialog();
                  
                          H1 titleHolder = new H1(this.getDialogTitle());
                          titleHolder.addClassName("mt-0");
                          titleHolder.setWidthFull();
                  
                          H3 headerHolder = new H3(this.getDialogHeaderText());
                          headerHolder.addClassName("mt-0");
                          headerHolder.setWidthFull();
                  
                          HorizontalLayout headerRow = new HorizontalLayout();
                          headerRow.add(headerHolder);
                          headerRow.add(this.getDialogHeaderIcon().create());
                          headerRow.setWidthFull();
                  
                          MSButton closeButton = new MSButton("Fermer", "success",
                                  VaadinIcon.CHECK_CIRCLE_O, event -> {
                                      dialog.close();
                                  });
                  
                          HorizontalLayout footerRow = new HorizontalLayout();
                          footerRow.add(closeButton);
                  
                          VerticalLayout footer = new VerticalLayout();
                          footer.setDefaultHorizontalComponentAlignment(Alignment.END);
                          footer.setAlignItems(Alignment.END);
                          footer.setWidthFull();
                          footer.add(footerRow);
                  
                          VerticalLayout container = new VerticalLayout();
                          container.add(titleHolder);
                          container.add(headerHolder);
                          container.add(this.grid);
                          container.add(footer);
                  
                          this.dialog.setWidth("700px");
                          this.dialog.setHeight("500px");
                  
                          this.dialog.add(container);
                      }
                  

                  结果如下:https://ibb.co/HNcgLK2

                  推荐答案

                  修复了使用 Lumo 主题而不是 Material one 的问题.

                  Fixed the problem by using Lumo theme instead of Material one.

                  这篇关于如何在 vaadin-flow 中正确指定对话框大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:单击中性按钮后是否可以保持对话框打开? 下一篇:Android - 使用 Xml 布局自定义对话框

                  相关文章

                • <i id='Y2WrY'><tr id='Y2WrY'><dt id='Y2WrY'><q id='Y2WrY'><span id='Y2WrY'><b id='Y2WrY'><form id='Y2WrY'><ins id='Y2WrY'></ins><ul id='Y2WrY'></ul><sub id='Y2WrY'></sub></form><legend id='Y2WrY'></legend><bdo id='Y2WrY'><pre id='Y2WrY'><center id='Y2WrY'></center></pre></bdo></b><th id='Y2WrY'></th></span></q></dt></tr></i><div id='Y2WrY'><tfoot id='Y2WrY'></tfoot><dl id='Y2WrY'><fieldset id='Y2WrY'></fieldset></dl></div>

                  <tfoot id='Y2WrY'></tfoot>
                    <bdo id='Y2WrY'></bdo><ul id='Y2WrY'></ul>

                      <small id='Y2WrY'></small><noframes id='Y2WrY'>

                      <legend id='Y2WrY'><style id='Y2WrY'><dir id='Y2WrY'><q id='Y2WrY'></q></dir></style></legend>