user1296107
user1296107

Reputation:

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. 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

Upvotes: 0

Views: 291

Answers (1)

Spiff
Spiff

Reputation: 4094

You can't do that with a plain ListBox which is wrapper for something like this:

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. 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.

Upvotes: 1

Related Questions