-1

我正在使用 Ignite UI 进行树视图拖放。

有什么办法可以将拖动的项目保留在列表中?
将项目拖放到新位置后,它会从先前位置删除项目。如何将物品保存在两个位置?

$("#StructureList").igTree({
                    singleBranchExpand: true,
                    checkboxMode: 'triState',
                    dataSource:  data,
                    dataSourceType: 'json',
                    bindings: {
                        textKey: 'LineName',
                        valueKey: 'LineID',
                        imageUrlKey: 'ImageUrl',
                        childDataProperty: 'FacDetails',
                        bindings: {
                            textKey: 'FacName',
                            valueKey: 'FacID',
                            childDataProperty: 'strDetails',
                                        bindings: {
                                            textKey: 'strName',
                                            valueKey: 'strID'
                                        }
                        }
                    },
                    dragAndDrop: true,
                    dragAndDropSettings: {
                        allowDrop: true,
                        dragAndDropMode: "copy",
                        customDropValidation: function (element) {
                            // Validates the drop target
                            var valid = true,
                                droppableNode = $(this);
                                if (droppableNode.is('a') && droppableNode.closest('li[data-role=node]').attr('data-value') === 'File') {
                                valid = false;
                            }

                            return valid;
                        }
                    }

                });
4

1 回答 1

2

Ignite UIigTree具有三种不同的拖放模式 - 默认、移动、复制。

默认 - 如果没有修改键,则移动删除的节点,如果持有,则复制ctrl
move - 删除的节点总是被移动,因此从源中删除。
复制 - 删除的节点始终被复制,因此保留在源中。

这是文档

为了让它始终复制,将树模式设置为copy.

$(".selector").igTree({
    dragAndDropSettings : {
        dragAndDropMode: "copy"
    }
});
于 2016-12-13T09:27:51.660 回答