user2236580
user2236580

Reputation: 99

Add objects to listbox

I am looking for a way to add objects other than just strings to a listbox.

For Example if i have an object of type Car with the fields brand,cost,colour, I want to be able to select the car in the listbox which displays the brand and use a changehandler to display the cost in a window.

Any ideas?

Upvotes: 0

Views: 146

Answers (1)

enrybo
enrybo

Reputation: 1785

I think what you're looking for is a CellList. Here's an example of what it can look like.

What you'll need to do is create your own type of Cell for which you supply it the object you want to display and it takes care of creating the HTML to display it.

You'll need to then put your values in a list and possibly a ListDataProvider which will give the CellList the objects it needs.

The CellList javadoc has a few good basic examples for all this.

Upvotes: 3

Related Questions