在extjs 7.5中出现“无法读取未定义属性(读取’getAnimatePolicy’)”的错误。

huangapple go评论68阅读模式
英文:

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

问题

我有一个组件,它使用 extend: 'Ext.tab.Panel',当我将它添加到容器中时,使用了 container.add(createView),其中 createView 是扩展了 Ext.tab.panel 的组件,它会抛出错误 cannot read properties of undefined (reading 'getAnimatePolicy')。在其他情况下,它可以正常工作,但在扩展 Ext.tab.panel 的情况下会出现此错误。

我正在使用 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

答案1

得分: 1

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.

英文:

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.

huangapple
  • 本文由 发表于 2023年4月19日 16:40:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76052417.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定