公司一个后台管理系统用ext开发的,初学ext,遇到动态为textfield赋值的问题:
?
下拉列表框选择个手机品牌,然后根据这个手机品牌动态为文本框赋值,把手机的首字母赋值给文本框。
?
首先,在下拉列表框事件列表中获取首字母,然后把结果回调给first
?
phoneBrandCombo.on('select',function(){
mobileCompTestServ.getPhoneFirstLetter(phoneBrandCombo.value.toString(),{callback : first, async : false});
})
?
第二,设置firstValue 的值,也就是要将其设置到文本框上的值
?
var firstValue ;
var first = function(data){
alert(data);
firstValue =data;
alert(firstValue);
Ext.get('firsttest').setValue(firstValue);
}
?
关键是在这句上:
Ext.get('firsttest').setValue(firstValue);
?成功。
?
je上大致列出了以下的方法:
var value="值"; (1) fs.form.findField(id/name).setValue(value); (2) Ext.get(id/name).setValue(value); (3) Ext.getCmp(id).setValue(value);
?但是当我使用(2)的时候没有成功
?
?
?
?
?