jiangnan2112 2010-06-01 22:35
浏览 520
已采纳

Ext 中如何设置radiogroup的fieldLabel?让fieldLabel显示不同的值

Ext中如何设置才能达到单选按钮和提示信息fieldLabel值在满足条件的时候同时显示或隐藏。
[code="java"]
//按钮
{
xtype:'radiogroup',
id : 'loc',
name : 'loc',
width: 300,
hidden : false,
fieldLabel:'', //这地方要不同的值,或隐藏 ?????
items : [
{boxLabel: '1', name: 'loc', inputValue: 1 },
{boxLabel: '2', name: 'loc', inputValue: 2 },
{boxLabel: '3', name: 'loc', inputValue: 3 },
{boxLabel: '4', name: 'loc', inputValue: 4 },
{boxLabel: '5', name: 'loc', inputValue: 5,checked: true}
]
}

[/code]
[code="java"]
//条件
selectRow = grid.getSelectionModel().getSelected();
if(selectRow.get('type') =='上海'){
Ext.getCmp('loc').fieldLabel=''; //这个if中倒底怎么写
}
[/code]

我要的结果是如果 type的值是'上海',那么页面就显示: 请选择地方 单选按钮1 单选按钮2 单选按钮3 单选按钮4
如果type不是上海,那么页面上的: 请选择地方 单选按钮1 单选按钮2 单选按钮3 单选按钮4 全都不显示
’请选择地方‘就是fieldLabel的值。请问这要实现这种功能应该怎么呢,着急。

我曾经是这么写的但不行。
[code="java"]
if(selectRow.get('type') =='上海'){
Ext.getCmp('loc').fieldLabel='请选择地方'; //1方式:这么写达不到要求,
// Ext.getCmp('loc').show(); //2方式:这么写按钮倒是不显示了,但文本 '请选择地方' 还是显示
}else{
Ext.getCmp('loc').fieldLabel=''; //1方式
// Ext.getCmp('loc').hide(); //2方式
}
[/code]

  • 写回答

7条回答 默认 最新

  • works001 2010-06-02 12:40
    关注
    Ext.onReady(function(){ var form = new Ext.form.FormPanel({ title: 'form', frame: true, autoHeight:true, layout:"form", items: [{ xtype:'radiogroup', id : 'loc', name : 'loc', width: 300, hidden : false, fieldLabel:'ddd', //这地方要不同的值,或隐藏 ????? items : [ {boxLabel: '1', name: 'loc', inputValue: 1 }, {boxLabel: '2', name: 'loc', inputValue: 2 }, {boxLabel: '3', name: 'loc', inputValue: 3 }, {boxLabel: '4', name: 'loc', inputValue: 4 }, {boxLabel: '5', name: 'loc', inputValue: 5,checked: true} ] }], renderTo: 'form', buttons:[{text:"ddd"}] }); Ext.get('change').on('click', function() { [color=red]form.items.item(0).setVisible(false); form.items.item(0).getEl().up('.x-form-item').setDisplayed(false); form.buttons[0].setVisible(false);[/color] }); Ext.get('change2').on('click', function() { [color=red]form.items.item(0).setVisible(true); form.items.item(0).getEl().up('.x-form-item').setDisplayed(true); form.items.item(0).el.dom.parentNode.parentNode.firstChild.innerHTML= 'ddddd:'; form.buttons[0].setVisible(true);[/color] }); });
    </head> 
    <body> 
        <div id="form"></div> 
    



    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(6条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料