weixin_42322952 2009-07-21 14:47
浏览 363
已采纳

'radiogroup' 的小问题.

,{
xtype: 'radiogroup',
itemCls: 'x-check-group-alt',
fieldLabel: 'Custom Layout
(w/ validation)',
allowBlank: false,
anchor: '95%',
items: [{
columnWidth: '.25',
items: [
{xtype: 'label', text: 'Heading 1', cls:'x-form-check-group-label', anchor:'-15'},
{boxLabel: 'Item 1', name: 'rb-cust1', inputValue: 1},
{boxLabel: 'Item 2', name: 'rb-cust1', inputValue: 2}
]
},{
columnWidth: '.5',
items: [
{xtype: 'label', text: 'Heading 2', cls:'x-form-check-group-label', anchor:'-15'},
{boxLabel: 'A long item just for fun', name: 'rb-cust2', inputValue: 3}
]
},{
columnWidth: '.25',
items: [
{xtype: 'label', text: 'Heading 3', cls:'x-form-check-group-label', anchor:'-15'},
{boxLabel: 'Item 4', name: 'rb-cust3', inputValue: 4},
{boxLabel: 'Item 5', name: 'rb-cust3', inputValue: 5}
]
}]
}

是这个着一大组都必须选定.而且样子也比较好看.
我想把每个都能是必添的'rb-cust1','rb-cust2','rb-cust3'都必须填写.
大家有什么办法么
[b]问题补充:[/b]
不行.一点效果都没有yourgame.还有别的办法么.着就是ext-3.0.0的那个例子中的一段..
[b]问题补充:[/b]
效果是这样的.(你可以看图,也可以看url http://www.extjs.com/deploy/dev/examples/form/check-radio.html)

url的最后一项是
Item 1
Item 2
A long item just for fun
Item 4
Item 5

着五个只要任意添一项就可以.

但我想Heading 1,Heading 2,Heading 3都是必添项
也就是说,
Item 1
Item 2
中必须有一个必添
Item 4
Item 5
中必须有一个必添
A long item just for fun
必须选种

才能通过allowBlank: false的验证.

  • 写回答

3条回答 默认 最新

  • zhoujuan520 2009-07-21 15:50
    关注

    [code="js"]
    Ext.onReady(function(){
    var individual2 = [{
    bodyStyle: 'padding-right:5px;',
    items: {
    xtype: 'fieldset',
    autoHeight: true,
    defaultType: 'radio', // each item will be a checkbox
    defaults:{hideLabel:true},
    items: [{
    xtype: 'label', text: 'Heading 1'
    }, {
    boxLabel: 'Dog',
    name: 'a'
    }, {
    labelSeparator: '',
    boxLabel: 'Cat',
    name: 'a'
    }, {
    checked: true,
    labelSeparator: '',
    boxLabel: 'Monkey',
    name: 'a'
    }]
    }
    },{
    bodyStyle: 'padding-right:5px;',
    items: {
    xtype: 'fieldset',
    autoHeight: true,
    defaults:{hideLabel:true},
    defaultType: 'radio', // each item will be a checkbox
    items: [{
    xtype: 'label', text: 'Heading 2'
    }, {
    fieldLabel: 'Favorite Animals',
    boxLabel: 'Dog',
    name: 'b'
    }, {
    fieldLabel: '',
    labelSeparator: '',
    boxLabel: 'Cat',
    name: 'b'
    }, {
    checked: true,
    fieldLabel: '',
    labelSeparator: '',
    boxLabel: 'Monkey',
    name: 'b'
    }]
    }
    }, {
    bodyStyle: 'padding-left:5px;',
    items: {
    xtype: 'fieldset',
    autoHeight: true,
    defaults:{hideLabel:true},
    defaultType: 'radio', // each item will be a radio button
    items: [{
    xtype: 'label', text: 'Heading 3'
    }, {
    checked: true,
    fieldLabel: 'Favorite Color',
    boxLabel: 'Red',
    name: 'c',
    inputValue: 'red'
    }, {
    fieldLabel: '',
    labelSeparator: '',
    boxLabel: 'Blue',
    name: 'c',
    inputValue: 'blue'
    }, {
    fieldLabel: '',
    labelSeparator: '',
    boxLabel: 'Green',
    name: 'c',
    inputValue: 'green'
    }]
    }
    }];

    var fp = new Ext.FormPanel({
    title: 'Check/Radio Groups Example',
    frame: true,
    labelWidth: 110,
    width: 600,
    renderTo:'form-ct',
    bodyStyle: 'padding:0 10px 0;',
    items: [
    {
    layout: 'column',
    border: false,

                defaults: {
                    columnWidth: '.33',
                    border: false
                },            
                items: individual2
    
            }
        ],
        buttons: [{
            text: 'Save',
            handler: function(){
    
            }
        },{
            text: 'Reset',
            handler: function(){
    
            }
        }]
    });
    

    });
    [/code]

    给你的代码没有测试,我本机示例已经做出来了

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

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看