PDA

View Full Version : tree.Panel drag'n'drop: on-fly dropped item modification



kid-
23 May 2012, 9:05 PM
Hello world!


I have two tree.Panel with different stores and one item I want to drop from one to another. Actually, in the first tree I have a component list - user choose one element, drag it to another tree and drop there. After it a window is opened with component options. So, I want user to fill the form. After it I'll take form's values and modify dropped item. But when this item is inserted in the second tree, there's no some fields I set in beforedrop event handler. Please tell me where am I wrong?




task_list_beforedrop: function(node, data, overModel, dropPosition, dropHandler, eOpts) {
var win = Ext.create('Ext.window.Window',{
modal:true,
title: 'Add task',
items:[{
xtype: 'taskForm',
}],
});
win.myExtraParams = { me: overModel, data: data, dropHandler: dropHandler };
win.on ('close',
function(win) {
if(!win.myExtraParams.success){ dropHandler.cancelDrop(); return; }
me = win.myExtraParams.me;
dropHandler = win.myExtraParams.dropHandler;
data = win.myExtraParams.data;
var form = win.child('panel').getForm();
var vars = form.getValues();
var nodeCopy = data.record[0].copy();
nodeCopy.set( 'text', vars['text'] );
nodeCopy.set( 'leaf', false );
nodeCopy.set( 'worker_obj', { 'name': form.findField('worker').findRecordByValue(vars['worker']).get('name') } );
nodeCopy.set( 'object_obj', { 'name': form.findField('object').findRecordByValue(vars['object']).get('name') } );
nodeCopy.set( 'iconCls', node.records[0].iconCls );
nodeCopy.set( 'parentId', me.get('id') );
nodeCopy.set( 'worker', vars['worker'] );
nodeCopy.set( 'object', vars['object'] );
data.records[0] = nodeCopy;
dropHandler.processDrop();
return true;
} );

win.show();
dropHandler.wait=true;


return false;
},

scottmartin
25 May 2012, 4:08 PM
See if these examples help:
http://dev.sencha.com/deploy/ext-4.0.1/examples/tree/two-trees.html
http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/dd/dnd_grid_to_grid.html

Scott.

kid-
25 May 2012, 8:23 PM
Hi Scott,

No, these examples doesn't help me. They are simple and doesn't include dropped item modification in beforedrop handler. Can I modify an item in beforedrop? Is it possible?

Best regards, Roman