PDA

View Full Version : A problem of DD



hzmdyz
30 Aug 2007, 6:52 PM
I have a TreePanel and a Grid in the same page.
I want to DragDrop from Grid to Tree.
when the browser is IE or FF,and server OS is widows, it works;
but when server is LINUX ,and browser is FF, it does not work;



grid = new Ext.grid.Grid('ticket-grid',
{
ds: ds
,cm: getColumnModel()
,loadMask : Divo.loadMask
,selModel: new Ext.grid.RowSelectionModel({singleSelect:false})
,enableDragDrop:true
,ddGroup:'treeDD'
}
);

pTree = new xt.TreePanel('project-tree',
{
animate:true
,enableDD:true
,ddGroup:'treeDD'
,containerScroll: true
,lines:false
,rootVisible:false
});

pTree.on('beforenodedrop', function(e){
onGridDrop(e);
e.cancel = true;
});


thanks!

Animal
30 Aug 2007, 11:33 PM
I can't see how it could create a new TreeNode to drop if you don't implement



pTree.dd.getTreeNode = function(data, targetNode, point, e) {
}


Which is called by the TreeDropZone on drop if the drag data does NOT contain a property called "node"

Or, you can implement



pTree.dd.getDragData = function(e){
var t = Ext.lib.Event.getTarget(e);
var rowIndex = this.view.findRowIndex(t);
if(rowIndex !== false){
var sm = this.grid.selModel;
if(!sm.isSelected(rowIndex) || e.hasModifier()){
sm.handleMouseDown(e, t);
}
var treeNodes = /* Your code to convert selected rows into tree nodes here... */
return {grid: this.grid, ddel: this.ddel, rowIndex: rowIndex, selections:sm.getSelections(), node: treeNodes};
}
}


Which creates the drag data which should contain a property called "node" which should be an Array or Ext.Tree.TreeNodes based on the selections.

That's probably the easiest option.

hzmdyz
19 Sep 2007, 11:25 PM
Thanks a lot to Animal for your helps.
but to create a new treenode when dropover is not what I want.
The question indeed now is the 'beforenodedrop' event can not fired when drop over on FF.