英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论