【问题标题】:How to prevent expanding of nativeselect contentcell vaadin如何防止扩展nativeselect contentcell vaadin
【发布时间】:2014-05-29 14:14:42
【问题描述】:

我在这样的表单布局中使用本机选择:
可以看到我原生的select内容太长了:

  accountType = new NativeSelect("Account Type:");
    accountType.setRequired(true);
    accountType.setNullSelectionItemId("--Select--");
    accountType.addItem("Regular Savings");
    accountType.addItem("Silver Savings");
    accountType.addItem("Gold Privilege");
    accountType.addItem("Advantage Premium Savings");

    idProof = new NativeSelect("ID Proof:");
    idProof.setSizeFull();
    idProof.setRequired(true);
    idProof.setNullSelectionItemId("--Select--");
    idProof.addItem("Arms License issued by State/Central Government authorities");
    idProof.addItem("Bank Pass Book with photograph issued  or its susidiaries or Nationalised Banks");


    FormLayout fLayout = new FormLayout(accountType,idProof);

然后我将这个formlayout添加到horizo​​ntalLayout

 HorizontalLayout hlayout = new HorizontalLayout(fLayout,fLayout2);

但我的 idProof 下拉单元格内容扩展了父级的宽度。
无论内容宽度如何,如何强制下拉菜单保持在父布局内​​?

【问题讨论】:

    标签: java web frameworks vaadin


    【解决方案1】:
    idProof.setWidth(20, Unit.EM);
    

    当然,您可以选择任何您想要的宽度,并且不再需要 idProof.setSizeFull()。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多