简体   繁体   English

如何在列表框中添加多个列?

[英]how to add multiple columns in listbox?

I want to create a listbox in gwt , which will contain two columns- say, name and sirname.These both columns should be visible. 我想在gwt中创建一个列表框,其中将包含两列-例如name和sirname,这两个列均应可见。 When I will select an item from listbox , I should be able to get both these values. 当我从列表框中选择一个项目时,我应该能够同时获得这两个值。 Also, is it possible to add column name in listbox which will remain unclickable? 另外,是否可以在列表框中添加将保持不可点击状态的列名? I have tried this- 我已经试过了

ListBox allRecs=new ListBox();
allRecs.addItem(name,sirname);

but here, sirname remains invisible. 但是在这里,先生姓名仍然不可见。

Thanks 谢谢

You can't do that with a plain ListBox which is wrapper for something like this: 您不能使用普通的ListBox来做到这一点,后者是像这样包装的:

select>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>

Plain GWT does not offer this out of the box. Plain GWT不提供此功能。 But you can create a textfield and a button (the button will show a popup with a table). 但是您可以创建一个文本字段和一个按钮(该按钮将显示带有表格的弹出窗口)。 There you can define as many columns as you like, make any rows you want unclickable etc. 您可以在其中定义任意多的列,使任何要取消点击的行等。

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

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