25 Jun 2012 8:03 PM #11
@Animal: Thanks for the reply!
Actually, that's what my code is doing. I assign each panels as a drop target, and their "dd".
Then I apply events on the dd.
On "onBeforeDrag" event, I initialize all the variables, the original sizes and position of the panel to be dragged.
On "onDrag" event, I make sure the proxy is correctly positioned (it is always positioned on the top area, not on the original location of the drag panel). This is to show where the dragged panel is from (and since I can't make it follow just like the DD Portal sample).
On "onDragOver", if the dragged panel is over the other panels set as drop targets, a new panel will be added (to act as a proxy, to tell the user where the dragged panel will be positioned if they drop it) depending on where the dragged panel is positioned above the other panel. If it is on top or bottom, a new panel will be added on top or bottom respectively (they are inside the vbox layout). If left or right, a new panel will be added on left or right respectively (they are inside the hbox layout now, and the new panel has a vbox layout).
On "onDragOut", the new added panel will be removed.
On "onDragDrop", the added panel (which acts as a proxy) is deleted and is replaced by the dragged panel (in reality, the real panel (which is hidden) is moved not the dragged panel (which is only a copy)). Size and position adjustments is also applied here. The issue appears here.
On "onInvalidDrop", the dragged panel will return to its original position. Adjustments is also applied here because sometimes the panel disappears.
This events are applied "afterrender" in 4.0.7 but it doesn't work in 4.1 because the "dd" is missing to the panels set as drop targets. I tried using "afterlayout" but I think it's not a good idea to use that event.
If only someone has a time to test and check my code, you will understand what I'm going through.
And also the latest scripts I posted is about adding panels to hbox and vbox. Adding new panels doesn't work properly if the size of the panels aren't equal to each other. Just a little drag of the splitter will mess it. It can be overcome by using "maintainFlex" but it only works in 4.0.7 not in 4.1.
Please, if I'm still not clear on my explanation, do tell me.
26 Jun 2012 1:40 AM #12
Here's the video of what my script do. Please observe carefully and most importantly please focus on the part where I arrange all the panels vertically. It's using ExtJS 4.0.7
I hope you understand now what I'm talking about in my first post.
And here's another video of comparison between 4.0.7 and 4.1 while doing D&D and adjusting panel size.
Note that "maintainFlex" is true only for panel titled "hbp1-vboxpanel1" and its parent panel.
28 Jun 2012 2:35 AM #13
I've also said earlier that the panels are missing after moving them.
It seems it was fixed in 4.1 but there's still an issue: the text in the titlebar is gone after moving.