Sharing components between DHX Windows


#1

I’ve encountered some odd behavior when trying to share components between windows by attaching them as needed. If I attach a component (such as a Form) to a window (ex: win1), then attach it to another window (ex: win2), it attaches to win2 just fine, and is removed from win1. But if I then try to attach it back to win1, it will not attach and stays on win2. Snippet to demonstrate: https://snippet.dhtmlx.com/u1qe2lfj

Even odder, I thought I’d see doing win1.attachHTML() would help, but instead I found that it made it possible to switch between the form and no content on one window, but the other would not change. I tested with another component (a list, in my above snippet), and found that win2 would switch between the form and the list, but win1 would show the list on the first switch, but never show any content again after that. Un-comment the lines in my snippet to observe this behavior.

Is there a way to share a component between multiple windows? (This is an attempt to work around the issue I previously reported about detaching window events.)


#2

Unfortunaetly such dynamic parent changing is not supported.
All I can suggest is to destruct your form and create a new one in another window.