13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Ext.define('KitchenSink.view.tree.TwoTrees', {
    extend: 'Ext.container.Container',
    
    requires: [
        'Ext.tree.*',
        'Ext.data.*',
        'Ext.layout.container.HBox'
    ],
    xtype: 'tree-two',
    
    //<example>
    exampleTitle: 'Drag and Drop between 2 TreePanels',
    exampleDescription: [
        '<p>The TreePanels have a TreeSorter applied in "folderSort" mode.</p>',
        '<p>Both TreePanels are in "appendOnly" drop mode since they are sorted.</p>',
        '<p>Target node is sorted upon drop to maintain initially configured sort order</p>',
        '<p>Hover at top or bottom edge of the tree to trigger auto scrolling while performing a drag and drop.</p>',
        '<p>The data for this tree is asynchronously loaded with a TreeStore and AjaxProxy.</p>'
    ].join(''),
    //</example>
    
    layout: {
        type: 'hbox',
        align: 'stretch'
    },
    height: 300,
    width: 550,
    
    initComponent: function(){
        var group = this.id + '-ddgroup';
        
        Ext.apply(this, {
            items: [{
                title: 'Source',
                xtype: 'treepanel',
                store: new Ext.data.TreeStore({
                    proxy: {
                        type: 'ajax',
                        //<example>
                        extraParams: {
                            path: Ext.repoDevMode ? '' : 'extjs'
                        },
                        //</example>
                        url: 'resources/data/tree/get-nodes.php'
                    },
                    root: {
                        text: 'Ext JS',
                        id: 'src',
                        expanded: true
                    },
                    folderSort: true,
                    sorters: [{
                        property: 'text',
                        direction: 'ASC'
                    }]
                }),
                margin: '0 15 0 0',
                flex: 1,
                viewConfig: {
                    plugins: {
                        ptype: 'treeviewdragdrop',
                        ddGroup: group,
                        appendOnly: true,
                        sortOnDrop: true,
                        containerScroll: true
                    }
                }
            }, {
                title: 'Custom Build',
                xtype: 'treepanel',
                store: new Ext.data.TreeStore({
                    proxy: {
                        type: 'ajax',
                        url: 'resources/data/tree/get-nodes.php',
                        extraParams: {
                            path: 'extjs'
                        }
                    },
                    root: {
                        text: 'Custom Ext JS',
                        id: 'src',
                        expanded: true,
                        children: []
                    },
                    folderSort: true,
                    sorters: [{
                        property: 'text',
                        direction: 'ASC'
                    }]
                }),
                flex: 1,
                viewConfig: {
                    plugins: {
                        ptype: 'treeviewdragdrop',
                        ddGroup: group,
                        appendOnly: true,
                        sortOnDrop: true,
                        containerScroll: true
                    }
                }
            }]
        });
        this.callParent();
    }
});