var confirmWindow = Ext.create('Ext.window.Window', {
title: 'Selected Item List',
autoHeight: true,
width: 500,
layout: 'fit',
modal: true,
items: [{
xtype: 'panel',
bodyPadding : 5,
items: [{
xtype: 'textfield',
id : 'freightFee',
fieldLabel: 'Freight Fee ',
name : 'freight' // I need this value, when I click the button
}]
}],
bbar: ['->', {
xtype: 'buttongroup',
items: [{
text: "test",
handler: function() {
// I want to get the textfield value (freightFee)
var freightFee = Ext.getCmp('freightFee').getValue(); // error :Ext.getCmp('freightFee') is undefined
}
}]
}
});
我有一个类似上面的窗口,我想要获取文本输入框值,当我点击按钮。Extjs4,如何检索单个文本框的值?
我试过,
var freightFee = Ext.getCmp('freightFee').getValue();
但错误消息说,
Ext.getCmp( 'freightFee')是未定义
有人知道吗?
谢谢!
仅供参考你的代码是缺少一个右']'结束掉的BBAR阵列,比其他,我使用Ext 4.1.0运行你的代码,并获得我期望的值。 –