Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6927863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:06:36+00:00 2026-05-27T11:06:36+00:00

i have a panel setup like this(each number represents a panel): 1 2 3

  • 0

i have a panel setup like this(each number represents a panel):

1 2
3 4
5 6
7 8

what i want to do is for example, i drag panel 1 over panel 6 and panel 1 should be at panel 6 and 6 should be at 1, like:

6 2
3 4
5 1
7 8

How can i do this ? :O

Ty in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:06:37+00:00Added an answer on May 27, 2026 at 11:06 am

    I suggest to use Sencha Portal feature with some modifications below to achieve this.

    My source code extended the portal example in latest version (4.0.7) as the following:

    1. portal.html
    <html>
    <head>   
        <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
        <link rel="stylesheet" type="text/css" href="portal.css" />
    
        <script type="text/javascript" src="../../builds/ext-core.js"></script>
        <script type="text/javascript" src="../../ext-all-debug.js"></script>
        <!-- shared example code -->
        <script type="text/javascript" src="../shared/examples.js"></script>
        <!--
            <script type="text/javascript" src="classes.js"></script> 
         -->
    
    
        <script type="text/javascript" src="portal.js"></script>
        <script type="text/javascript">
            Ext.Loader.setConfig({enabled:true});
            Ext.Loader.setPath('Ext.app', 'classes');
    
            Ext.require([
                'Ext.layout.container.*',
                'Ext.resizer.Splitter',
                'Ext.fx.target.Element',
                'Ext.fx.target.Component',
                'Ext.window.Window',
                'Ext.app.Portlet',
                'Ext.app.PortalColumn',
                'Ext.app.PortalPanel',
                'Ext.app.Portlet',
                'Ext.app.PortalDropZone',
                'Ext.app.GridPortlet',
                'Ext.app.ChartPortlet'
            ]);
    
            Ext.onReady(function(){
                Ext.create('Ext.app.Portal');
            });
        </script>
    </head>
    <body>
        <span id="app-msg" style="display:none;"></span>
    </body>
    </html>
    
    1. portal.js
    Ext.define('Ext.app.Portal', {
    
        extend: 'Ext.container.Viewport',
    
        uses: ['Ext.app.PortalPanel', 'Ext.app.PortalColumn', 'Ext.app.GridPortlet', 'Ext.app.ChartPortlet'],
    
        getTools: function(){
            return [{
                xtype: 'tool',
                type: 'gear',
                handler: function(e, target, panelHeader, tool){
                    var portlet = panelHeader.ownerCt;
                    portlet.setLoading('Working...');
                    Ext.defer(function() {
                        portlet.setLoading(false);
                    }, 2000);
                }
            }];
        },
    
        initComponent: function(){
            var content = '<div class="portlet-content">'+Ext.example.shortBogusMarkup+'</div>';
    
            Ext.apply(this, {
                id: 'app-viewport',
                layout: {
                    type: 'border',
                    padding: '0 5 5 5' // pad the layout from the window edges
                },
                items: [{
                    id: 'app-header',
                    xtype: 'box',
                    region: 'north',
                    height: 40,
                    html: 'Ext Portal'
                },{
                    xtype: 'container',
                    region: 'center',
                    layout: 'border',
                    items: [{
                        id: 'app-options',
                        title: 'Options',
                        region: 'west',
                        animCollapse: true,
                        width: 200,
                        minWidth: 150,
                        maxWidth: 400,
                        split: true,
                        collapsible: true,
                        layout: 'accordion',
                        layoutConfig:{
                            animate: true
                        },
                        items: [{
                            html: content,
                            title:'Navigation',
                            autoScroll: true,
                            border: false,
                            iconCls: 'nav'
                        },{
                            title:'Settings',
                            html: content,
                            border: false,
                            autoScroll: true,
                            iconCls: 'settings'
                        }]
                    },{
                        id: 'app-portal',
                        xtype: 'portalpanel',
                        region: 'center',
                        items: [{
                            id: 'col-1',
                            items: [{
                                id: 'portlet-1',
                                title: 'Grid Portlet',
                                tools: this.getTools(),
                                items: Ext.create('Ext.app.GridPortlet'),
                                listeners: {
                                    'close': Ext.bind(this.onPortletClose, this)
                                }
                            },{
                                id: 'portlet-2',
                                title: 'Portlet 2',
                                tools: this.getTools(),
                                html: content,
                                listeners: {
                                    'close': Ext.bind(this.onPortletClose, this)
                                }
                            }]
                        },{
                            id: 'col-2',
                            items: [{
                                id: 'portlet-3',
                                title: 'Portlet 3',
                                tools: this.getTools(),
                                html: '<div class="portlet-content">'+Ext.example.bogusMarkup+'</div>',
                                listeners: {
                                    'close': Ext.bind(this.onPortletClose, this)
                                }
                            },{
                                id: 'portlet-4',
                                title: 'Stock Portlet',
                                tools: this.getTools(),
                                items: Ext.create('Ext.app.ChartPortlet'),
                                listeners: {
                                    'close': Ext.bind(this.onPortletClose, this)
                                }
                            }]
                        }]
                    }]
                }]
            });
            this.callParent(arguments);
        },
    
        onPortletClose: function(portlet) {
            this.showMsg('"' + portlet.title + '" was removed');
        },
    
        showMsg: function(msg) {
            var el = Ext.get('app-msg'),
                msgId = Ext.id();
    
            this.msgId = msgId;
            el.update(msg).show();
    
            Ext.defer(this.clearMsg, 3000, this, [msgId]);
        },
    
        clearMsg: function(msgId) {
            if (msgId === this.msgId) {
                Ext.get('app-msg').hide();
            }
        }
       });
    
    1. PortalDropZone.js
        Ext.define('Ext.app.PortalDropZone', {
        extend: 'Ext.dd.DropTarget',
    
        constructor: function(portal, cfg) {
            this.portal = portal;
            Ext.dd.ScrollManager.register(portal.body);
            Ext.app.PortalDropZone.superclass.constructor.call(this, portal.body, cfg);
            portal.body.ddScrollConfig = this.ddScrollConfig;
        },
    
        ddScrollConfig: {
            vthresh: 50,
            hthresh: -1,
            animate: true,
            increment: 200
        },
    
        createEvent: function(dd, e, data, col, c, pos) {
            return {
                portal: this.portal,
                panel: data.panel,
                columnIndex: col,
                column: c,
                position: pos,
                data: data,
                source: dd,
                rawEvent: e,
                status: this.dropAllowed
            };
        },
    
        notifyOver: function(dd, e, data) {
            var xy = e.getXY(),
                portal = this.portal,
                proxy = dd.proxy;
    
            // case column widths
            if (!this.grid) {
                this.grid = this.getGrid();
            }
    
            // handle case scroll where scrollbars appear during drag
            var cw = portal.body.dom.clientWidth;
            if (!this.lastCW) {
                // set initial client width
                this.lastCW = cw;
            } else if (this.lastCW != cw) {
                // client width has changed, so refresh layout & grid calcs
                this.lastCW = cw;
                //portal.doLayout();
                this.grid = this.getGrid();
            }
    
            // determine column
            var colIndex = 0,
                colRight = 0,
                cols = this.grid.columnX,
                len = cols.length,
                cmatch = false;
    
            for (len; colIndex < len; colIndex++) {
                colRight = cols[colIndex].x + cols[colIndex].w;
                if (xy[0] < colRight) {
                    cmatch = true;
                    break;
                }
            }
            // no match, fix last index
            if (!cmatch) {
                colIndex--;
            }
    
            // find insert position
            var overPortlet, pos = 0,
                h = 0,
                match = false,
                overColumn = portal.items.getAt(colIndex),
                portlets = overColumn.items.items,
                overSelf = false;
    
            len = portlets.length;
    
            for (len; pos < len; pos++) {
                overPortlet = portlets[pos];
                h = overPortlet.el.getHeight();
                if (h === 0) {
                    overSelf = true;
                } else if ((overPortlet.el.getY() + (h / 2)) > xy[1]) {
                    match = true;
                    break;
                }
            }
    
            pos = (match && overPortlet ? pos : overColumn.items.getCount()) + (overSelf ? -1 : 0);
            var overEvent = this.createEvent(dd, e, data, colIndex, overColumn, pos);
    
            if (portal.fireEvent('validatedrop', overEvent) !== false && portal.fireEvent('beforedragover', overEvent) !== false) {
    
                // make sure proxy width is fluid in different width columns
                proxy.getProxy().setWidth('auto');
    
                if (overPortlet) {
                    proxy.moveProxy(overPortlet.el.dom.parentNode, match ? overPortlet.el.dom : null);
                } else {
                    proxy.moveProxy(overColumn.el.dom, null);
                }
    
                this.lastPos = {
                    c: overColumn,
                    col: colIndex,
                    p: overSelf || (match && overPortlet) ? pos : false
                };
                this.scrollPos = portal.body.getScroll();
    
                portal.fireEvent('dragover', overEvent);
                return overEvent.status;
            } else {
                return overEvent.status;
            }
    
        },
    
        notifyOut: function() {
            delete this.grid;
        },
    
        notifyDrop: function(dd, e, data) {
            delete this.grid;
            if (!this.lastPos) {
                return;
            }
            var c = this.lastPos.c,
                col = this.lastPos.col,
                pos = this.lastPos.p,
                panel = dd.panel,
                dropEvent = this.createEvent(dd, e, data, col, c, pos !== false ? pos : c.items.getCount());
    
            if (this.portal.fireEvent('validatedrop', dropEvent) !== false && this.portal.fireEvent('beforedrop', dropEvent) !== false) {
    
                // make sure panel is visible prior to inserting so that the layout doesn't ignore it
                panel.el.dom.style.display = '';
                /*
                 * Start customization
                 * Switch position of two panels when drop
                 */
                var sourceColumn = panel.ownerCt;
                var sourceRow = sourceColumn.items.indexOf(panel);
                if (pos !== false) {
                    var targetPanel = c.items.getAt(pos);
                    sourceColumn.insert(sourceRow, targetPanel);
                    c.insert(pos, panel);
                } else {
                    c.add(panel);
                }
                /*
                 * End of customization
                 */
                dd.proxy.hide();
                this.portal.fireEvent('drop', dropEvent);
    
                // scroll position is lost on drop, fix it
                var st = this.scrollPos.top;
                if (st) {
                    var d = this.portal.body.dom;
                    setTimeout(function() {
                        d.scrollTop = st;
                    },
                    10);
                }
    
            }
            delete this.lastPos;
            return true;
        },
    
        // internal cache of body and column coords
        getGrid: function() {
            var box = this.portal.body.getBox();
            box.columnX = [];
            this.portal.items.each(function(c) {
                box.columnX.push({
                    x: c.el.getX(),
                    w: c.el.getWidth()
                });
            });
            return box;
        },
    
        // unregister the dropzone from ScrollManager
        unreg: function() {
            Ext.dd.ScrollManager.unregister(this.portal.body);
            Ext.app.PortalDropZone.superclass.unreg.call(this);
        }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this test case def setUp(self): self.user = User.objects.create(username=tauri, password='gaul') def test_loginin_student_control_panel(self): c
I have panel that is using group layout to organize some label. I want
I have a panel on an aspx page which contains an UpdatePanel. This panel
I have a Panel and I am adding controls inside this panel. But there
i have a panel (A), which contains 3 other panels (AA, AB, AC). Each
I have a page setup like so: <ajax:UpdatePanel id=UpdatePanel1 runat=server UpdateMode=Conditional> <ContentTemplate> <asp:TextBox id=TextBox1
I have 2 JPanels in a frame. The first panel contains java items like
I have: 1 paging scroll view at the bottom (like a panel) that is
Lets say I have a set of model classes like this: public class Person
I have the models set up like this: class ParentModel(models.Model): some_col = models.IntegerField() some_other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.