-
3 May 2011 2:55 AM #1
[CLOSED]Drag and Drop problem within complex layout
[CLOSED]Drag and Drop problem within complex layout
I did the following:
- used complex layout from:
http://dev.sencha.com/deploy/ext-4.0...t/complex.html
- added id "tab1_panel" to the first tab in the center.
- added a window at the end of the Ext.onReady function
When I now try to move around the window, it jumps (exactly by the offset of the tab panel) when dropping it. The same happens with other Components like the SVG-Tiger when renderedTo the panel.Code:var testWin = new Ext.Window({ title: 'Test', width: 100, height: 100, renderTo: Ext.get('tab1_panel'), constraint: true }); testWin.show();
Testet with IE9, Firefox4 and Chrome11 + Ext.js 4
Is this a bug or I am just missing something?
-
4 May 2011 7:44 AM #2
Live test case...
Live test case...
To test this issue, please visit: http://old.madmaxmatze.de/complex_test.html
Within the source I clearly marked all changes I made. I would really appreciate any help on this!!!
-
4 May 2011 8:28 AM #3
This is the "old" way of doing it:
Code:Ext.getCmp('tab1_panel').add({ xtype: 'window', title: 'Test', width: 100, height: 100, constrain: true }).show();Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
4 May 2011 1:38 PM #4
Using the "old" way of creating elements solved my problem 100% - with windows, drawComponents, etc. So it seems the renderTo attribute is not working very well or has to be used in a different way.
-
25 May 2011 10:30 PM #5
This your "new way of doing it" really makes no sense if I, for example, want to DEFINE a default window rendered to some panel, like:
In this case I still have to use renderTo. Panel with id 'panelId' is located at a distance of 30px from the top and this window is always snapped downwards by exactly these 30px after being dragged.Code:Ext.define('My.view.Window',{ extend:'Ext.window.Window', initComponent:function(){ Ext.apply(this,{ renderTo:'panelId', closeAction:'hide', constrainHeader:true }); this.callParent(arguments) } });
For anyone who is looking for at least some way of fixing this, here's what worked for me (taking in account those 30px):
Now this isn't exactly a "clean" solution but it works ('maximize' and 'restore' events internally fire the 'move' event so those need to be implemented too).Code:Ext.define('My.view.Window',{ extend:'Ext.window.Window', initComponent:function(){ Ext.apply(this,{ renderTo:'panelId', closeAction:'hide', constrainHeader:true }); this.callParent(arguments); var fit=function(comp){ var pos=comp.getPosition(); comp.suspendEvents(); comp.setPosition(pos[0],pos[1]); comp.resumeEvents() }; this.on('maximize',fit,this); this.on('restore',fit,this); this.on('move',function(comp,x,y){ comp.suspendEvents(); comp.setPosition(x,y-30); comp.resumeEvents() },this) } });
-
28 May 2011 2:25 AM #6
Another way to fix the bug, it's to apply following patch:
Code:Ext.panel.Panel.override({ unghost: function(show, matchPosition) { var me = this; if (!me.ghostPanel) { return; } if (show !== false) { me.el.show(); if (matchPosition !== false) { var basePos = Ext.fly(this.renderTo || Ext.getBody()).getXY(); var gp = me.ghostPanel.getPosition(); me.setPosition(gp[0] - basePos[0], gp[1] - basePos[1]); } if (me.floatingItems) { me.floatingItems.show(); } Ext.defer(me.focus, 10, me); } me.ghostPanel.el.hide(); } });
-
5 Jun 2011 10:15 PM #7
-
30 Dec 2011 7:03 PM #8
This issue appears to be back now, with 4.1-beta.
This override seems to work, for now...
Code:Ext.Component.override({ setPagePosition: function(x, y, animate) { var me = this, p, floatParentBox; if (Ext.isArray(x)) { y = x[1]; x = x[0]; } me.pageX = x; me.pageY = y; if (me.isContainedFloater()) { // Floating Components which are registered with a Container have to have their x and y properties made relative if (me.isContainedFloater()) { floatParentBox = me.floatParent.getTargetEl().getViewRegion(); if (Ext.isNumber(x) && Ext.isNumber(floatParentBox.left)) { x -= floatParentBox.left; } if (Ext.isNumber(y) && Ext.isNumber(floatParentBox.top)) { y -= floatParentBox.top; } } me.setPosition(x, y, animate); } else { p = me.el.translatePoints(x, y); me.setPosition(p.left, p.top, animate); } return me; } });
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
Drag & Drop issue between 2 region of a complex layout
By paquerette in forum Ext 2.x: Help & DiscussionReplies: 21Last Post: 10 May 2009, 5:57 AM -
Complex table drag and drop
By suaveant in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 6 Aug 2008, 1:05 PM -
Drag and Drop of Divs el in a Complex Layout Questions
By Janachi in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 19 Jun 2008, 8:18 AM -
Complex Drag n Drop problem
By mpatel in forum Ext 2.x: Help & DiscussionReplies: 5Last Post: 18 Jan 2008, 11:15 AM


Reply With Quote
