分享

checkbox (Group)

 王的空间0056 2015-11-24
{
                xtype: 'fieldset',
                id: 'distinguishs',
                border: false,
                layout: {align: 'middle',pack: 'center',type: 'hbox'},
                defaultType: 'checkbox',
                items: [{
                id: '11',
                name: 'distinguish',
                tabIndex: '5',
                boxLabel: '11',
                inputValue: '11'
                },
                {
                id: '12',
                name: 'distinguish',
                tabIndex: '6',
                inputValue: '12',
                boxLabel: '12'
                },
                {
                id: '13',
                name: 'distinguish',
                tabIndex: '7',
                inputValue: '13',
                boxLabel: '13',
                }
                ]
            }
=========================
var xqCheck = Ext.getCmp('distinguishs').items;
var ids = '';
for(var i = 0; i < xqCheck.length; i++){
       if(xqCheck.get(i).checked){
        ids += ',' + xqCheck.get(i).inputValue;
        }
}
if(ids.length > 0){
    ids = ids.substr(1);
    Ext.MessageBox.alert('提示', '您的兴趣是' + ids);
}      

======================
{
xtype: 'checkboxgroup',
fieldLabel: 'Hobby',
id: 'hobby',
columns: 2,
vertical: true,
items: [
{ boxLabel: 'music', name: 'rb', inputValue: '1', checked: true },
{ boxLabel: 'sport', name: 'rb', inputValue: '2' },
{ boxLabel: 'draw', name: 'rb', inputValue: '3' }
]
}
====================
//获取通过checkboxgroup定义的checkbox值
var hobbyValue = Ext.getCmp('hobby').getChecked();
var hobby;
Ext.Array.each(hobbyValue, function(item){
hobby += '+' + item.boxLabel;
});
Ext.MessageBox.alert('提示', '您的兴趣是' + hobby);     

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约