日期:2014-05-16 浏览次数:20366 次
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Grid to FormPanel Drag and Drop Example</title> <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" /> <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script> <script type="text/javascript" src="../../ext-all-debug.js"></script> <script type="text/javascript" src="../shared/code-display.js"></script> <link rel="stylesheet" type="text/css" href="../shared/examples.css" /> <body></body> <script> Ext.onReady(function(){ DraggablePanel = Ext.extend(Ext.Panel, { draggable: { insertProxy: true, isTarget : false }, height: 120 }); Ext.reg('portlet', DraggablePanel); var viewport = new Ext.Viewport({ layout: 'column', items: [{ columnWidth: .333, baseCls: 'x-plain', bodyStyle:'padding:0px', defaults: {frame: true, style: 'margin: 10px'}, items: [ new DraggablePanel({ title: 'Portal 00', html: 'portal 00' }), new DraggablePanel({ title: 'Portal 01', html: 'portal 01' }), new DraggablePanel({ title: 'Portal 02', html: 'portal 02' }), new DraggablePanel({ title: 'Portal 03', html: 'portal 03' }) ] }, { columnWidth: .333, baseCls: 'x-plain', bodyStyle:'padding:0px', defaults: {frame: true, style: 'margin: 10px'}, items: [ new DraggablePanel({ title: 'Portal 10', html: 'portal 10' }), new DraggablePanel({ title: 'Portal 11', html: 'portal 11' }), new DraggablePanel({ title: 'Portal 12', html: 'portal 12' }) ] }, { columnWidth: .333, baseCls: 'x-plain', bodyStyle:'padding:0px', defaults: {frame: true, style: 'margin: 10px'}, items: [ new DraggablePanel({ title: 'Portal 20', html: 'portal 20' }), new DraggablePanel({ title: 'Portal 21', html: 'portal 21' }), new DraggablePanel({ title: 'Portal 22', html: 'portal 22' }) ] }] }); var overrides = { onDragDrop: function(evtObj, targetElId) { var p = this.panel; var srcContainer = p.findParentByType('panel'); var destContainer = Ext.getCmp(targetElId); var s = srcContainer.remove(p, false); srcContainer.doLayout(); destContainer.insert(this.insertIndex, s); p.el.dom.style.display = '';