Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!