javascriptextjsextjs7

Getting cannot read properties of undefined (reading 'getAnimatePolicy') in extjs 7.5


I have my component that extend : 'Ext.tab.Panel' and when I add that to my container using container.add(createView) where createView is the component thats extending Ext.tab.panel it throws error cannot read properties of undefined (reading 'getAnimatePolicy'). It works fine in other cases but in the one where we extend: Ext.tab.panel. Extjs have removed this method from Ext.tab.Panel but since my way of adding the view in container is generic It throws this error.

I'm using extjs 7.5 version if you guys have any change that you can recommend that would be very helpful


Solution

  • First of all, I am sorry for my poor English. A looked at your code, you have some mistakes:

    You use Ext.create to create a panel component, and trying to remove it in button's handler. After you call tabpanel.removeAll() this component become deleted and don't exist anymore. Don't use Ext.create, method add() should have config object

        var panel = {
              xtype: 'panel',
              title: 'Test'
        };
        //...
        handler: function() { 
        //... 
            tabpanel.add(panel);
        }
    

    Try to DO NOT use Ext.getCmp and 'id' property, you can navigate from component to component by using up() and down() methods or view's references with this.lookup('refName') in controller.

    Also you can use component.setLoading('Waiting...') to show mask and .setLoading(false) to hide it instead of Ext.getCmp('mask') or etc.