Reputation: 120
When use a node to show combobox's items only display the fisrt item I select.
val sspSelected = SimpleStringProperty()
val myItems = FXCollections.observableArrayList("Item 1", "Item 2","Item 3")
combobox<String>(sspSelected){
items = myItems
cellFormat {
graphic = cache{
label(it)
}
}
}
label(sspSelected)
Upvotes: 0
Views: 198
Reputation: 7297
You are using cache
without supplying a cache key, so the graphic node for the cell is calculated from the first value it sees. Simply supply a unique id, in this case the string value as a cache key:
graphic = cache(it) {
label(it)
}
Upvotes: 1