This repository has been archived by the owner on Sep 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 271
View Params Object Not Updating in Subsequent openModal() Calls #443
Comments
Wouldn't it be more apropriate to use a fragment here? |
Yes it would. The behavior described her is by design. In general I think parameters should be avoided and replaced with injected ViewModels. Changing to Fragment is a reasonable thing to do, since parameters are only evaluated when the UIComponent is created. |
However, the result when using View is probably not what you expect, so I'll think about a better solution to this. |
I found a solution to this. Using the latest snapshot, parameters passed to views will now be reevaluated as you'd expect :) |
edvin
pushed a commit
that referenced
this issue
Sep 10, 2017
class ParamTestApp : App(ParamCallerView::class)
class ParamCallerView : View() {
override val root = button("Open modal with param") {
action {
find<ParamReceiverView>(mapOf("name" to "Param ${LocalDateTime.now()}")).openModal()
}
}
}
class ParamReceiverView : View() {
val name: String by param()
override val root = vbox()
override fun onDock() {
with(root) {
label(name)
}
currentStage?.sizeToScene()
}
} |
@bekwam Did you have a chance to try this now? |
This is fixed in the 1.7.11 release. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
produces a ParamsView4 object with access to the two properties myval1 and myval2 as in
However, a second button press resulting in a second find() will not update the params object in the View.
I think the problem is that the inheritParentHolder object is only setting the map in the View (Component) at instance creation and there is no reference kept which will update the map.
The text was updated successfully, but these errors were encountered: