Results 1 to 3 of 3

Thread: DnD from Tree to Grid.Bug?

  1. #1
    Ext JS Premium Member
    Join Date
    Jul 2011
    Posts
    33
    Answers
    1
    Vote Rating
    1
      0  

    Default DnD from Tree to Grid.Bug?

    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 ?

    Code:
    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
        });
    });

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,382
    Answers
    3997
    Vote Rating
    1529
      0  

    Default

    With your example, I dragged the first leaf node from tree 1 to tree 2. It appeared in tree 2 and stayed in tree 1. I then dragged the same leaf node from tree 1 to grid 1 and it appeared in grid 1 and stayed in tree 1. I didn't get any errors using 4.1.1
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Ext JS Premium Member
    Join Date
    Jul 2011
    Posts
    33
    Answers
    1
    Vote Rating
    1
      0  

    Default

    You have to drag the second leaf node from tree 1 to grid 1.The second time,you drag it,you get the following error: 'internalId' is null or not an object

    I had to override Ext.grid.ViewDropZone.handleNodeDrop to resolve the problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •