WildOne (Yuri)
04/02/2021, 12:19 PMval agents: ObservableList<AgentModel> by lazy {
transaction(db) {
addLogger(StdOutSqlLogger)
AgentEntity.all().map {
AgentModel().apply {
item = it
}
}.toObservable()
}
}
yet it seems like I can't get the UI to update when the DB changes. Do I need to update the agents list manually?Bogdan
04/02/2021, 4:50 PMlazy
initialization, which means that your code is executed once on the first call.
Alas, JDBC
does not yet support notifications
that could help.
You should create a separate controller (if you haven't created one), and an empty ObservableList
. Start an asynchronous task with a repetition of the execution of the query in the database, whether the result of the compare query has changed or not.
ObservableList
- Reacts to additions and deletions.
ObservableMap
- only if the value is not equals. The same goes for ObservableProperty
WildOne (Yuri)
04/02/2021, 4:53 PMBogdan
04/02/2021, 4:58 PMWildOne (Yuri)
04/02/2021, 5:07 PMBogdan
04/02/2021, 5:08 PMWildOne (Yuri)
04/02/2021, 5:10 PMBogdan
04/02/2021, 5:12 PM