It’s an idea to have method-based property field always refreshed on screen.
When I have a method-based property
@JmixProperty
@DependsOnProperties("stakeholders")
fun getCurrentOwnersString(): String = stakeholders.filter { it.type?.code == InspectionStakeholderType.OWNER && it.current == true }.joinToString(", ") { it.fullName ?: "" }
And a screen with a field currentOwnersString
when I add a new stakeholder in the stakeholders list, the field is refreshed,
but when I modify an existing stakeholder already in the stakeholders list, there is no refresh.
It’s possible to track change on the screen but would not be better to have something like an event listener to fire a change on stakeholders if a field of stakeholder is changed ?
Something like
@EventListener
open fun onInspectionCaseStakeholderSaving(event: EntitySavingEvent<InspectionCaseStakeholder>) {
event.fireChangeOn(event.entity.parentFieldCase.stakeholders)
}