0
我使用ExtJS 3.3.0,我想要禁用保存按钮,直到组合框中有一个值。ExtJS 3.3.0禁用保存按钮,直到组合框值
我创建组合框就像这样;
new Ext.form.ComboBox({
id: this.idName + 'Combo_StateID',
name: 'StateID',
fieldLabel: 'State',
singleOnly: true,
typeAhead: true,
triggerAction: 'all',
store: StateStore,
mode: 'remote',
valueField: 'StateID',
hiddenField: 'StateID',
displayField: 'StateNumber',
lazyInit: false,
listClass: 'x-combo-list-small',
tpl: '<tpl for=\".\"><div class=\"x-combo-list-item\"><span style=\"width: 50px;\">#{StateNumber}</span></div></tpl>',
}), ") . "
我只是像这样创建按钮;
newPanel.addButton(
{
iconCls:'icon-ok',
text: 'Save Data'
}
)
这一切工作正常。但禁用我无法想象的按钮。
我已经尝试了以下,但仍然没有;
listeners: {
afterrender: function() {
if (this.getValue() === null) {
Ext.getCmp('yourButton').setDisabled(true);
}
else {
Ext.getCmp('yourButton').setDisabled(false);
}
}
}
任何帮助,将不胜感激
使用if(this.getValue()=== “”),因为的getValue()如果未设置值返回空字符串。 –