radio横向排序

来源:互联网 发布:人工智能 配方 编辑:程序博客网 时间:2024/05/18 02:09

默认radio是垂直排在一列,网上很多朋友说采用下面代码即可解决:

{           
xtype: 'panel',           
layout: 'table',           
fieldLabel: '项目权限',          
defaultType: 'radio',          
isFormField: true,           
items: [{            
name: 'prjPermissionCode',           
boxLabel: '自由进入',          
value: ''         
},{               
name: 'prjPermissionCode',               
boxLabel: '需要验证',               
value: ''        
}]
}

但是在我的测试过程中发现标签也消失了,而且样式特别粗黑。不知是版本原因还是我没用对。说明一下,我用的版本是Ext3.31。

方法一:

items:{
                    layout:'column',
                    defaultType: 'radio',
                    fieldLabel: 'omitNorms',
                    width : 165,
                    items: [
                        {boxLabel: 'Yes', name: 'omitnorms', inputValue: 'true',width:50},
                        {boxLabel: 'No', name: 'omitnorms', inputValue: 'false'}
                    ]}

方法二:

items:{

                    xtype: 'radiogroup',
                    fieldLabel: 'omitNorms',
                    width : 165,
                    items: [
                        {boxLabel: 'Yes', name: 'omitnorms', inputValue: 'true',width:50},
                        {boxLabel: 'No', name: 'omitnorms', inputValue: 'false'}
                    ]}

横向排列是可以了,不过firefox下在保存提交的时候报错了。

方法一:提交到后台的值为omitnorms :[false,false],若把上面一个设为checked:true,则传值为[true,false]

方法二:在到达后台之前就报 too much recurion

具体原因请看后面一篇日志:主要是getFieldValues()和getVaules()区别。

原创粉丝点击