Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

183
Visualizações
How to make swapable component in exJs or in javascript

How to make swapable component in exJs or in javascript.

I have two components and both are dragabble.

            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',
            }

When I drag one to another it is overlapping. How can we swap the positon of both element in extJS.

Any other library help will also work.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

onDrop you add it to a the parent container via insert.

To get the correct position you can either calculate it based on the mouse position or ...

onDrop you get the target dom element you are currently at.

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

parent.insert(droppedItem, currentIndex);

Further work

  • If you use a placeholder proxy you can even preview these.
  • Use snap if your components are the same size.

Example

Fiddle

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda