簡體   English   中英

如何在 exJs 或 javascript 中制作可交換組件

[英]How to make swapable component in exJs or in javascript

如何在 exJs 或 javascript 中制作可交換組件。

我有兩個組件,兩者都是可拖動的。

            xtype : "panel",
            title: 'My Apps',
            region: 'east',
            width: 290,
            items:[{
                xtype : 'panel',
                cls: 'myCLS',
                iconCls : 'app-info-appstore',
                title: 'Home',
                draggable : true,
                html : 'Home.',
                listeners: {
                    'render': function(panel) {
                        panel.body.on('click', function() {
                            alert('onclick');
                        });
                     }
                 }
                
            },{
                xtype : 'panel',
                cls: 'myCLS',
                title: 'Profile',
                iconCls : "app-info-iconToure",
                draggable : true,
                html : 'Apps',
            }

當我將一個拖到另一個時,它是重疊的。 我們如何交換 extJS 中兩個元素的位置。

任何其他圖書館幫助也將起作用。

請注意大衛因為你通常不會回應其他人的帖子,這是我最后一次幫助: 1、2你甚至沒有給我賞金3

onDrop 你通過insert將它添加到父容器中。

要獲得正確的 position,您可以根據鼠標 position 或...

onDrop 你得到你當前所在的目標 dom 元素。

const extComponent = Ext.ComponentManager.from(domEl),
      currentIndex = ... // search for the position of that item in parent

parent.insert(droppedItem, currentIndex);

進一步的工作

  • 如果您使用占位符代理,您甚至可以預覽這些。
  • 如果您的組件大小相同,請使用 snap。

例子

刪除,因為你不回答

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM