Thursday 15 August 2013

ExtJS5 tree dragdrop deep copy -



ExtJS5 tree dragdrop deep copy -

in extjs5 have treepanel drag drop enabled. when drag node children source tree target tree parent node copied.

if seek deep clone in 'beforedrop' listener, fails next error: ext.data.model.constructor(): bad model constructor argument 2 - "session" not session

the view has viewcontroller not have viewmodel.

tree definition in view:

xtype: 'treepanel', itemid: 'myprojectstree', rootvisible: false, viewconfig: { plugins: { ptype: 'treeviewdragdrop', enabledrag: false, enabledrop: true }, listeners: { beforedrop: 'dodrop',....

in controller:

dodrop: function(dropnode, dragnode, overmodel) { var node = dragnode.records[0]; var clonednode = node.copy('111', true);<--- failed here

i have seen sessions defined in viewmodel scenario. re-create function need have viewmodel session defined ? there way around this. there bug in extjs5.

any help appreciated!

afaik there bug in ext js related copying tree nodes (extjs-13725). should modify/override copy method in ext.data.nodeinterface:

// copy: function(newid, deep) { copy: function(newid, session, deep) { var me = this, result = me.callparent(arguments), len = me.childnodes ? me.childnodes.length : 0, i; if (deep) { (i = 0; < len; i++) { // result.appendchild(me.childnodes[i].copy(undefined, true)); result.appendchild(me.childnodes[i].copy(undefined, session, true)); } } homecoming result; }

basically in original code there no session argument, while there should be.

tree extjs5

No comments:

Post a Comment