I have coded a script that opens a popup window when a binded boolean custom property turns True. Is there any way to retrive/store some data introduced by the user in the pop up and store in the properties of the component that has the bind that threw the pop up ?
Thanks
Best option is likely to send a message back from the popup. Then create a message handler on the view with the component, to capture and set whatever data you need.
1 Like
The sendMessage method is also what I tend to do, but you can also use session properties, or even memory tags, to store the data. This allows you to bind properties from both views to the data.
There are serious negatives to either of these approaches when users can open multiple tabs of the same project, or multiple users can run the project simultaneously. Using session props or memory tags are not comparable to sending targeted messages.
1 Like
Okay, thanks you, this is working. But now I am having another problem. The view that has the handler is used as widget of a dashboard, so can be instanciated severals times in the page. With this approach when open a popup for one of the widgets and saving the changes triggering the sendMessage, since all the widgets have embedded the same view, so the same handler, all the widgets receives the changes. How to make that the handler is defined per widget so only the widget that triggered the popup receives the message back with the new payload.
Thanks!
I do finaly implemented using the sendMessage and the handlerand it is working. But now I am having another problem. The view that has the handler is used as widget of a dashboard, so can be instanciated severals times in the page. With this approach when open a popup for one of the widgets and saving the changes triggering the sendMessage, since all the widgets have embedded the same view, so the same handler, all the widgets receives the changes. How to make that the handler is defined per widget so only the widget that triggered the popup receives the message back with the new payload.
Thanks in advance!
Give all of your widgets a unique ID as a parameter, add the ID of the widget you want to transmit the message to into the message payload, then filter the messages by that ID so only the widget that has the correct ID listens to the message.
2 Likes
Pass an index through to your popup that uniquely indentifies that widget. Then when you send your message back, include the index in your payload and have any widgets recieving the message, discard/ignore if their index does not match.
2 Likes