<@U6HGX8YQ7> The reason is that your cellFormat fu...
# tornadofx
e
@andy.burdett The reason is that your cellFormat function isn't binding any text to the textProperty of the cell, it's merely assigning text to it when the cell is updated. What you see is actually not that it's updated when you add another item, but rather it's updated when the cell for the item that was changed receives an update request from the ListView (which as you've seen happens when you add another item). You can deal with this in several ways, from just calling refresh() on the ListView, to actually binding towards the textProperty(). The easiest thing is probably to change
cellFormat { text = it.title}
to
cellFormat { textProperty.cleanBind(it.titleProperty) }
a
Thanks. That's worked. I got the my original approach from the TornadoFx samples ItemViewModelWithPojos.kt
e
Generally it's better to leave it as in the sample, as this will be faster and require less memory/cleanup, but if you do need everything to update on change, this is the way to go. Maybe you want to submit a PR with the alternative and a comment in ItemViewModelWithPojos.kt?
Actually, it won't work with pojos, as they are not observable.