PDA

View Full Version : Drag and drop panel inside the viewport



shanmugam
13 Sep 2012, 4:09 AM
I have an viewport with 6 panel initially load,
which are loading and able to drag and drop.

In the viewport listener: afterRender function.
I am adding a new item (panel) into the viewport,

My question is, the panel added in runtime is not able to drag and drop.

Please suggest me

Regards,
Shanmugam

scottmartin
13 Sep 2012, 4:27 AM
Perhaps sharing your code would help.

Scott.

shanmugam
13 Sep 2012, 9:48 PM
I got it working,:)

I have added "onDrag" function and "endDrag" function to the panel, See the code below.

new Ext.Panel({
id: 'batt2',
draggable: {
onDrag: function(e) {
var el = this.proxy.getEl();
this.x = el.getLeft(true);
this.y = el.getTop(true);
},

endDrag: function(e) {
this.panel.setPosition(this.x, this.y);
}
},

title: 'Battery 2',
style:'padding:0px 0px 10px 0px',
layout:'fit',
tools: tools,
anchor: '-0',
items: gridpnlbatt2,
collapsible: true
});

scottmartin
14 Sep 2012, 4:05 AM
Thank you for posting your solution.

Scott.