adp-gmt
21 Sep 2012, 2:06 AM
Hello,
I am using EXTJS 4.1.1
Why the behavior differs depending on whether I DnD from Tree1 to Tree2 and from Tree1 to Grid1?
In the following example, when I DnD the node "Drag me,please.Id assigned by adp-gmt" from Tree1 to Tree2 and from Tree1 to Grid1 ,it's works fine.When I DnD the node "Drag me,please.Id assigned by adp-gmt" from Tree1 to Tree2 and from Tree1 to Grid1 again, the DnD from Tree1 to Grid1 throws the following error ("'internalId' is null or not an object") because I try to insert another record with the same Id.
Should I override Ext.grid.ViewDropZone ?
Ext.require(['*']);
Ext.onReady(function(){
var store = Ext.create('Ext.data.TreeStore', {
root: {
text: 'tree1',
id: 'src',
expanded: true,
children: [
{ text: "Drag me,please.Id not assigned by adp-gmt", leaf: true },
{ text: "Folder", expanded: true, children: [
{ id: 'new-id',text: "Drag me,please.Id assigned by adp-gmt", leaf: true }
] }
]
}
});
var tree1 = Ext.create('Ext.tree.Panel', {
id: 'tree1',
store: store,
width: 300,
height: 150,
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop',
ddGroup : 'ddGroup',
enableDrop : false
},
copy: true
},
renderTo: document.body
});
var store2 = Ext.create('Ext.data.TreeStore', {
root: {
text: 'tree2',
id: 'src',
expanded: true,
children: [
{ text: "One Piece", leaf: true },
{ text: "Folder", expanded: true, children: [
{ text: "Casshern", leaf: true }
] }
]
}
});
var tree2 = Ext.create('Ext.tree.Panel', {
id: 'tree2',
width: 300,
height: 150,
store: store2,
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop',
ddGroup : 'ddGroup'
}
},
renderTo: document.body
});
var grid1 = new Ext.grid.Panel({
id: 'grid1',
width: 300,
height: 150,
store : new Ext.data.Store({
id:'store1',
fields: ['id','text'],
data : [{id : 'node1', text : 'node1'},{id : 'node2', text : 'node2'}]
}),
columns : [ {text: 'id', dataIndex: 'id'},{text: 'text', dataIndex: 'text'}],
viewConfig: {
plugins:{
ptype: 'gridviewdragdrop',
ddGroup : 'ddGroup'
}
},
renderTo: document.body
});
});
I am using EXTJS 4.1.1
Why the behavior differs depending on whether I DnD from Tree1 to Tree2 and from Tree1 to Grid1?
In the following example, when I DnD the node "Drag me,please.Id assigned by adp-gmt" from Tree1 to Tree2 and from Tree1 to Grid1 ,it's works fine.When I DnD the node "Drag me,please.Id assigned by adp-gmt" from Tree1 to Tree2 and from Tree1 to Grid1 again, the DnD from Tree1 to Grid1 throws the following error ("'internalId' is null or not an object") because I try to insert another record with the same Id.
Should I override Ext.grid.ViewDropZone ?
Ext.require(['*']);
Ext.onReady(function(){
var store = Ext.create('Ext.data.TreeStore', {
root: {
text: 'tree1',
id: 'src',
expanded: true,
children: [
{ text: "Drag me,please.Id not assigned by adp-gmt", leaf: true },
{ text: "Folder", expanded: true, children: [
{ id: 'new-id',text: "Drag me,please.Id assigned by adp-gmt", leaf: true }
] }
]
}
});
var tree1 = Ext.create('Ext.tree.Panel', {
id: 'tree1',
store: store,
width: 300,
height: 150,
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop',
ddGroup : 'ddGroup',
enableDrop : false
},
copy: true
},
renderTo: document.body
});
var store2 = Ext.create('Ext.data.TreeStore', {
root: {
text: 'tree2',
id: 'src',
expanded: true,
children: [
{ text: "One Piece", leaf: true },
{ text: "Folder", expanded: true, children: [
{ text: "Casshern", leaf: true }
] }
]
}
});
var tree2 = Ext.create('Ext.tree.Panel', {
id: 'tree2',
width: 300,
height: 150,
store: store2,
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop',
ddGroup : 'ddGroup'
}
},
renderTo: document.body
});
var grid1 = new Ext.grid.Panel({
id: 'grid1',
width: 300,
height: 150,
store : new Ext.data.Store({
id:'store1',
fields: ['id','text'],
data : [{id : 'node1', text : 'node1'},{id : 'node2', text : 'node2'}]
}),
columns : [ {text: 'id', dataIndex: 'id'},{text: 'text', dataIndex: 'text'}],
viewConfig: {
plugins:{
ptype: 'gridviewdragdrop',
ddGroup : 'ddGroup'
}
},
renderTo: document.body
});
});