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

115
Visualizações
Extjs application is crashed when dynamically adding one defective item

When an item is dynamically added to the created component, if there is an error in the item, the application crashes.

This problem does not exist when the item is not created.

Ext.define('Test', {
    extend: 'Ext.panel.Panel',

    initComponent: function () {
        //  make error
        // this.callParent();
    }
});

Ext.create('Ext.panel.Panel', {
    renderTo: Ext.getBody(),
    width: 400,
    height: 300,
    title: 'Application',
    layout: {
        type: 'vbox',
        align: 'center',
    },

    defaults: {
        margin: 10,
    },

    items: [{
        xtype: 'button',
        iconCls: 'x-fa fa-cog',
        handler: function (btn) {
            let mainPanel = btn.up('panel'),
                item = Ext.create('Test');

            // bug
            mainPanel.add(item);
        },
    }],
});


sencha fiddle

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

0

Strange problem, because you are trying to find out if the developer did something wrong during runtime.

But anyways - here is one solution for your problem:

        handler: function (btn) {
            let mainPanel = btn.up('panel'),
                item = Ext.create('Test');

            // bug testing
            if(Ext.isDefined(item) && Ext.isObject(item.layout)) {
                mainPanel.add(item);
            } else {
                console.error(item.id + ' could not be added because of an error I made.')
            }
        },
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