假設我有以下一段代碼:如何在extjs中獲取xtype的值?
{
xtype : 'textfield',
xxxx : 'firstname',
//I just need a method to return xxxx's value(which is firstname)
yyyy : this.hypothetical_get_xxxx_value()}
}
這似乎無用,但我需要一些配置對象的值。怎麼做?
假設我有以下一段代碼:如何在extjs中獲取xtype的值?
{
xtype : 'textfield',
xxxx : 'firstname',
//I just need a method to return xxxx's value(which is firstname)
yyyy : this.hypothetical_get_xxxx_value()}
}
這似乎無用,但我需要一些配置對象的值。怎麼做?
我不確定我是否正確地理解了這個問題,但訪問xxxx的一種方法是將itemId: 'myTextFieldName',
添加到您的textField對象中,以便可以引用它。然後使容器組件上的呼叫(如FormPanel中)來獲取文本框對象的XXXX屬性:
var value = containingComponent.getComponent('myTextFieldName').xxxx
試試這個,
如果你有一個文本框id屬性,你可以得到任何屬性值, 例如:
{
xtype : 'textfield',
xxxx : 'firstname',
yyyy : this.hypothetical_get_xxxx_value()}
id : 'somename'
}
var xxxxValue = Ext.getCmp('somename').xxxx;
// it will give you xxxx's value...