Ext 表单隐藏 和显示 根据下拉框选择不同的值 显示不同的文本框 只显示了文本框没有显示fieldLabel

Ext.onReady(function(){this.username={id:'usernameId',tabIndex:4,xtype:'textfield',fi... Ext.onReady(function(){

this.username = {
id:'usernameId',
tabIndex:4,
xtype:'textfield',
fieldLabel: '密码',
cls:'x-upper-text',
width:80,
name: 'username',
maxLength:25,
upperText: true,
anchor:'98%'
};
this.password = {
id:'passwordId',
tabIndex:4,
xtype:'textfield',
fieldLabel: '密码',
cls:'x-upper-text',
width:80,
name: 'password',
maxLength:25,
upperText: true,
anchor:'98%',
hidden: true,
hideLabel:true
};
this.age = {
id:'ageId',
tabIndex:4,
xtype:'textfield',
fieldLabel: '年纪',
cls:'x-upper-text',
width:80,
name: 'age',
maxLength:25,
upperText: true,
anchor:'98%'//,
//hidden: true,
//hideLabel:true
};

this.type = new Ext.form.ComboBox({
tabIndex:3,
width:80,
anchor:'100%',
fieldLabel: '用户类型',
cls:'x-upper-text',
hiddenName:'docType',
store: new Ext.data.SimpleStore({
fields: ['type', 'typeName'],
data: [
['0', '(0)普通用户'],
['1', '(1)管理员']
]
}),
valueField:'type',
displayField:'typeName',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
forceSelection : true,
width:100,
listeners:{
select:function(combo, record, index){
//alert(record.get('type')+" index : "+index +" combo : "+combo);
var t=record.get('type');
alert(t);
if(t==0){
Ext.getCmp('passwordId').show();
}else{
Ext.getCmp('passwordId').setVisible(false);
}
}.createDelegate(this)
}
});
this.searchForm = new Ext.FormPanel({
labelAlign: 'right',
frame:true,
width: 300,
items:[{
layout:'form',
items:[this.username,this.type,this.password,this.age]
}]
});
new Ext.Window({
title: "窗口",
width: 400,
height: 400,
bodyStyle: "padding: 5px",
items:[this.searchForm]
}).show(Ext.getBody());
})
展开
 我来答
Charles618
2014-12-16 · 超过31用户采纳过TA的回答
知道答主
回答量:100
采纳率:0%
帮助的人:79.6万
展开全部
首先把hiddenLanel:true属性去掉.然后select 函数修改如下:
select:function(combo, record, index){
//alert(record.get('type')+" index : "+index +" combo : "+combo);
var t=record.get('type');
alert(t);
if(t==0){
Ext.getCmp('passwordId').setDisabled(false);
Ext.getCmp('passwordId').setVisible(true);
}else{
Ext.getCmp('passwordId').setDisabled(true);
Ext.getCmp('passwordId').setVisible(false);
}
你可以试试看 行不行.
zhangxh357
2014-10-25 · 超过21用户采纳过TA的回答
知道答主
回答量:72
采纳率:0%
帮助的人:49.7万
展开全部
this.password 中 hiddenLabel:true 这句话去掉
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式