首页 > 解决方案 > 拖放插入 ExtJS 7.3 Classic

问题描述

我正在使用 ExtJS 将拖放功能应用于仪表板中的面板。这些面板内部有小部件,通过拖放用户可以更改这些小部件的位置。

但是当我删除一个小部件时,我正在更改两个小部件的索引,并且目标小部件正在再次加载。

当我删除一个小部件时,我不希望任何小部件再次加载。我该如何解决?

这是我的删除代码:

setDropZone: function (cmp) {
            cmp.DropZone = Ext.create("Ext.dd.DropZone", cmp.getEl(), {
                getTargetFromEvent: function (event) {
                    return cmp;
                },
                onNodeDrop: function (target, dd, e, data) {
                    debugger;
                    var component = cmp.up();
                    var tempWidgetIndex = data.componentClone.widgetIndex;

                    data.componentClone.widgetIndex = target.widgetIndex;

                    target.widgetIndex = tempWidgetIndex;

                    // Insert target to currents place
                    component.insert(target.widgetIndex, target);
                    target.saveState();

                    // Insert current to target
                     component.insert(
                         data.componentClone.widgetIndex,
                         data.componentClone
                     );
                     data.componentClone.saveState();
                },
                ddGroup: "ddgroup"
            });
        }

如果有人可以提供帮助,那将非常有帮助!非常感谢

标签: extjsdrag-and-dropextjs7

解决方案


推荐阅读