Tornadofx: ItemViewModel binding of ObservableList

Created on 6 Mar 2018  路  2Comments  路  Source: edvin/tornadofx

Hello guys,

I have a model class that has a observable list property. When I generate an item view model for this model class it binds my list to a property of type Property>.
So I can't bind this property e.g. to a DataGrid.
Is there a way to bind this so that the observable list is not wrapped in a property? I could not find anything in the provided guide or in the examples. Can anyone give me a hint?

class Demo(val list: ObservableList<String> = observableArrayList<String>())

class DemoModel : ItemViewModel<Demo>() {
    val list = bind(Demo::list)
}

Thanks in advance and kind regards

Most helpful comment

You should be able to cast the bind expression to a SimpleListProperty:

val list: SimpleListProperty<String> = bind(Demo::list)

All 2 comments

You should be able to cast the bind expression to a SimpleListProperty:

val list: SimpleListProperty<String> = bind(Demo::list)

Thanks for your quick and helpfull answer. Worked like a charm :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Leo-Thura picture Leo-Thura  路  6Comments

arslancharyev31 picture arslancharyev31  路  7Comments

MairwunNx picture MairwunNx  路  3Comments

chinzen picture chinzen  路  7Comments

AlmasB picture AlmasB  路  8Comments