我試圖讓這個複選框獲取複選框的值,而不使用Ext.getCmp
Ext.define('myRoot.myExtApp.myForm', {
extend: 'Ext.form.Panel',
layout: {
type: 'vbox',
align: 'stretch'
},
scope: this,
constructor: function() {
this.callParent(arguments);
this.myFieldSet = Ext.create('Ext.form.FieldSet', {
scope: this,
columnWidth: 0.5,
collapsible: false,
defaultType: 'textfield',
layout: {
type: 'hbox', align: 'stretch'
}
});
this.mySecondForm = Ext.create('myRoot.myExtApp.myForm2', {
scope: this,
listener: this,
margin: '1 3 0 0'
});
this.myCheckBox = Ext.create('Ext.form.Checkbox', {
scope: this,
//id: 'myCheckBox',
boxLabel: 'Active',
name: 'Active',
checked: true,
horizontal: true
});
this.myFieldSet.add(this.mySecondForm);
this.myFieldSet.add(this.myCheckBox);
this.add(this.myFieldSet);
}
});
的價值正如你可以看到我有另一種形式
Ext.define('myRoot.myExtApp.myForm2', {
在那裏我有一個處理程序,應從「myForm」獲取複選框的值
如何在不使用Ext.getCmp的情況下從Form2獲取我的複選框的值?我知道我能得到複選框的值,如果我做
Ext.getCmp('myCheckBox').getValue();
但使用
this.myCheckBox.getValue();
給我不確定的錯誤。
UPDATE - 與Wared建議,我想這裏面myForm2
this.temp=Ext.create('myRoot.myExtApp.myForm'), {});
var tempV = this.temp.myCheckBox.getValue();
我能得到的價值,但我得到同樣的真實價值,即使我取消選中該複選框
您還沒有發佈足夠的結構,我們需要了解它是如何融合在一起的。 – 2013-03-01 23:32:58
爲了擴展Evan的反應 - 不可能在'this.myCheckBox'中告訴'this'的範圍是什麼。 – Izhaki 2013-03-03 16:42:08
@EvanTrimboli,感謝您花時間看我的文章。請參閱我的更新。我用我的完整結構編輯了它。 – EagleFox 2013-03-04 16:00:21