PDA

View Full Version : dragend, drag events do not get fired in Ext.Panel (ExtJS 4.1.0-rc2)



badallen
19 Apr 2012, 5:09 PM
Hi, I have the following code that pretty much copied the portal sample but add the listeners -


Ext.define('Ext.app.Portlet', {
extend: 'Ext.panel.Panel',
alias: 'widget.portlet',
layout: 'fit',
anchor: '100%',
frame: true,
closable: true,
collapsible: true,
animCollapse: true,
draggable: {
moveOnDrag: false,
listeners: {
dragend: function(){
console.log('dragend');
}
}
},
cls: 'x-portlet',


// Override Panel's default doClose to provide a custom fade out effect
// when a portlet is removed from the portal
doClose: function() {
//some code
}
});

The issue is it does not seem like dragend is fired at all!

The reason why I need this is I need to persist the display order of the panel after the drag. Do you guys have any better idea on how to do this?

Thanks!

Animal
20 Apr 2012, 3:08 AM
Panels are not moved by a ComponentDragger instance (Subclass of DragTracker) so the draggable will not be observable. DD clases are not Observable right now.

They are moved by an instance of Ext.panel.DD.

So you need



draggable: {
moveOnDrag: false,
endDrag: function() {
Ext.panel.DD.prototype.endDrag.apply(this, arguments);
console.log('dragend');
}
},