1

嗨,我是 extjs 4 的新手,我在树拖放中遇到问题,在拖放和 dropi 中,将在叶子中放置一个节点,该叶子更改为文件夹,而该叶子更改为放置节点的父节点

在我的代码下面

// Go ahead and create the TreePanel now so that we can use it below
var treePanel = Ext.create('Ext.tree.Panel', {
    id: 'tree-panel',
    title: 'Taxonomy',
    region: 'west',
    collapsible: true,
    split: true,
    multiSelect: true,
    height: '100%',
    width: '20%',
    minWidth: 100,
    rootVisible: false,
    autoScroll: true,
    store: store,
    viewConfig: {
        allowCopy: true,


        plugins: {
            ptype: 'treeviewdragdrop',
            appendOnly: true,
            ddGroup: 'selDD'
        },

        listeners: {
            beforedrop: function (node, data, overModel, dropPos, opts) {
                nodeval = data.records[0].data.text;
                //parent  = overModel.node.parentNode.id;
                this.droppedRecords = data.records;
                data.records = [];
            },
            drop: function (node, data, overModel, dropPos, opts) {
                var str = '';
                Ext.iterate(this.droppedRecords, function (record, node, data, dropPosition, dropFunction, parentNode) {
                    //  str += record.get('Patent_number') + ' (id = ' + record.get('Tech1') + ') dropped on ' +overModel.data.text + 'with id'+overModel.data.id+ '\n';
                    Ext.MessageBox.show({
                        title: 'Copy?,Drag/drop?',
                        msg: 'Do you wish to copy (or) drag/drop this node?',
                        buttons: {
                            ok: 'Copy',
                            no: 'Drag/drop',
                            cancel: 'Cancel'
                        },
                        buttonText: {
                            yes: "Copy",
                            no: "Drag/drop",
                            cancel: "Cancel"

                        },
                        fn: function (btn, text) {
                            if (btn == 'no') {
                                Ext.Ajax.request({
                                    url: 'json/dragedrop.php',
                                    method: "GET",
                                    params: {
                                        idFrom: treeID,
                                        idTo: overModel.data.id,
                                        taxo_id: '<?php echo $taxe_id;?>'
                                        //fromtext: data.records[0].data.text 
                                        //parentid:overModel.node.parentNode.id

                                    },
                                    success: function (response) {
                                        store.load();
                                    }
                                });

但是上面的代码不起作用,拖动节点不会掉入叶子中,它显示一个红色标记,

请建议并提供参考代码提前谢谢

4

1 回答 1

0

我认为这不是一个正确的答案,但这是这个问题的另一种逻辑

appendOnly:false, 在给定的插件droped node parenthover node,那个时候被删除的节点hover node变成了parent

我认为它只在某些时候使用

于 2013-03-15T08:09:59.497 回答