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

  • SEARCH
  • Home
  • 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 6318281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:37:18+00:00 2026-05-24T15:37:18+00:00

How to allow drag & drop panels in a main panel ? I have

  • 0

How to allow drag & drop panels in a main panel ?
I have a panel which contains one panel ( for the moment ) or somes panels and i want allow drag and drop for organize panels.
like this examples : http://examples.extjs.eu/freedrag.html
but i don’t understand how to adapte this with my application .

My code :
( Is the Sticky items into tabobj tab.Panel then i want drag & drop )

Ext.require([
    'Ext.grid.*',
    'Ext.data.*',
    'Ext.util.*',
    'Ext.Action',
    'Ext.tab.*',
    'Ext.button.*',
    'Ext.form.*',
    'Ext.layout.*'
]);

Ext.onReady(function() {

    Ext.tip.QuickTipManager.init();

    Ext.define('Mesclasses.objet.sticky', {

        alias: ['widget.stick'],
        extend: 'Ext.panel.Panel',
        bodyStyle: {
            background: 'yellow',

        },
        height: 150,

        width: 150,
        margin: '10 0 0 10',
        draggable: true,
        items: [{

            xtype: 'label',
            text: 'Title',
            listeners: {

                move: function (me, x, y, opt) {

                    alert('move');
                }
            }
        }],
    });

    var item2 = Ext.create('Ext.Panel', {
        title: 'Accordion Item 2',
        html: '<empty panel>',
        cls: 'empty'
    });

    var item3 = Ext.create('Ext.Panel', {
        title: 'Accordion Item 3',
        html: '<empty panel>',
        cls: 'empty'
    });

    var item4 = Ext.create('Ext.Panel', {
        title: 'Accordion Item 4',
        html: '<empty panel>',
        cls: 'empty'
    });

    var item5 = Ext.create('Ext.Panel', {
        title: 'Accordion Item 5',
        html: '<empty panel>',
        cls: 'empty'
    });

    var accordion = Ext.create('Ext.Panel', {
        region: 'west',
        margins: '5 0 5 5',
        split: true,
        width: 210,
        layout: 'accordion',
        items: [item2, item3, item4, item5]
    });

    var paneltitle = Ext.create('Ext.panel.Panel', {
        region: 'north',
        html: '<h1 class="x-panel-header" id="title">Your Sticky World</h1>',
        height: 40

    });

    var montab = Ext.create('Ext.tab.Tab', {
        title: 'lol',
    });

    var tabobj = Ext.create('Ext.tab.Panel', {

        region: 'center',
        //xtype: 'tabpanel', // TabPanel itself has no title
        activeTab: 0, // First tab active by default

        items: [{
            title: 'My Stickys',
            xtype: 'panel',

            items: [{

                xtype: 'stick',
            }]
        }]
    });

    Ext.create('Ext.container.Viewport', {
        layout: 'border',
        renderTo: Ext.getBody(),
        items: [
            paneltitle,
            accordion, {
                region: 'south',
                title: 'South Panel',
                collapsible: true,
                html: 'Information goes here',
                split: true,
                height: 100,
                minHeight: 100
            }, {
                region: 'east',
                title: 'East Panel',
                collapsible: true,
                split: true,
                width: 150
            },
            tabobj]
    });
});
  • 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-24T15:37:19+00:00Added an answer on May 24, 2026 at 3:37 pm

    Reviewing the sources of the page could help.

    The main idea is, generally, to create Ext.dd.DDProxy for each panel you are dragging.
    So, the following snippet could help you get the basic functionality working:

    {
        title: 'My Stickys',
        xtype: 'panel',
        items : [{
            xtype : 'stick',
            listeners : {
                afterrender : function(stick){
                    stick.dd = new Ext.dd.DDProxy(stick.el.dom.id, 'group');
                }
            }
        }]
    }
    

    Or, to be more generic (check the afterrender listener):

    Ext.define('Mesclasses.objet.sticky',{
        alias : ['widget.stick'],
        extend : 'Ext.panel.Panel',
        bodyStyle: {
            background: 'yellow',
    
        },
        height : 150,
    
        width : 150,
        margin : '10 0 0 10',
        draggable : true,
        items: [{
            xtype: 'label',
            text : 'Title',
            listeners : {
                move : function(me,x,y,opt){
                    alert('move');
                }
            }
        }], 
        listeners : {
            afterrender : function(stick){
                stick.dd = new Ext.dd.DDProxy(stick.el.dom.id, 'group');
            }
        }
    });
    

    Here is the render part you are mostly interested in (original page using ExtJS 3 though):

    // runs after the window is rendered
    ,afterRender:function() {
    
        // create items using template
        Ext.Window.prototype.afterRender.apply(this, arguments);
        this.tpl.overwrite(this.body, this);
    
        // setup D&D
        var items = this.body.select('div.draggable');
    
        // loop through draggable items
        items.each(function(el, ce, index) {
    
            // create DDProxy
            el.dd = new Ext.dd.DDProxy(el.dom.id, 'group');
    
            // configure the proxy
            Ext.apply(el.dd, {
                 win:this
                ,itemIndex:index
    
                // runs on drag start
                // create nice proxy and constrain it to body
                ,startDrag:function(x, y) {
                    var dragEl = Ext.get(this.getDragEl());
                    var el = Ext.get(this.getEl());
    
                    dragEl.applyStyles({border:'','z-index':this.win.lastZIndex + 1});
                    dragEl.update(el.dom.innerHTML);
                    dragEl.addClass(el.dom.className + ' dd-proxy');
    
                    this.constrainTo(this.win.body);
                } // eo function startDrag
    
                // runs on drag end
                // save new position of item and fire itemdrag event to save state
                ,afterDrag:function() {
                    var el = Ext.get(this.getEl());
                    var div = this.win.divs[this.itemIndex];
                    div.x = el.getLeft(true);
                    div.y = el.getTop(true);
                    this.win.fireEvent('itemdrag', this);
                } // eo function afterDrag
    
            }) // eo apply
    
        }, this); // eo each
    } // eo function afterRender
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to allow drag-and-drop re-ordering of photoshop-like layers. Assuming I have 3 canvas
I have an NSTableView which I wish to allow users to drag-and-drop video files
I have a DataGridView, where I allow users to Drag/Drop rows to reorder them.
I have a Flex3 project with 2 HorizontalList controls; one of which has drag
I have a Silverlight application that needs Drag-And-Drop functionality because I allow the user
Is it possible to allow users to drag and drop items in mobile safari?
I want to allow a user to drag my Win32 window around only inside
My bat script accepts a filepath as a parameter, which allows me to drag-and-drop
I want to allow dropping of image files in my application: Users can Drag
I have a tab control which allows me to drag the tab items out

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.