开发者

extjs combo not defined error

开发者 https://www.devze.com 2023-02-08 04:29 出处:网络
I have a Panel. Inisde the Panel, I do a initComponent: function() {this.someCombo = new someDefaultCombo(...)}

I have a Panel. Inisde the Panel, I do a initComponent: function() {this.someCombo = new someDefaultCombo(...)} Then I do:

this.somePredefinedForm.items.add(someCombo); //Line 2

And I get:

Erro开发者_高级运维r: someCombo is not defined

at Line2.

But I am defining it at the top. So why there is js error?

EDIT: When I changed this to:this.somePredefinedForm.items.add(this.someCombo); , the error went away. But why?


this.someCombo is te way to access someCombo. This is the object in Panel not something global like you try at the begining


if you are executing this:

this.somePredefinedForm.items.add(this.someCombo);

not in initComponent function then make sure that this refers to object that contains initComponent function.

0

精彩评论

暂无评论...
验证码 换一张
取 消