复选框checkBox,单选框radioBox。CheckboxGroup
如果在formPanel中使用了checkBox,radioBox时,在提交表单时使用formPanel.getForm().submit()来提交数据时,如果单选框和复选框未选中时,则extjs是不会提交这些控件的。在postdata中根本就不存在这些控件的任何影子。可以通过firebug来查看提交的数据。
var checkboxgroup_temp = new Ext.form.CheckboxGroup({
id:'myGroup',
xtype: 'checkboxgroup',
fieldLabel: '多选',
itemCls: 'x-check-group-alt',
// Put all controls in a single column with width 100%
columns: 1,
items : [{
layout : 'column',
items: [
{boxLabel: 'Item 1', name: 'cb-col-1'},
{boxLabel: 'Item 2', name: 'cb-col-2', checked: true},
{boxLabel: 'Item 3', name: 'cb-col-3'}
]
},{
layout : 'column',
items: [
{boxLabel: 'Item 1', name: 'cb-col-1'},
{boxLabel: 'Item 2', name: 'cb-col-2', checked: true},
{boxLabel: 'Item 3', name: 'cb-col-3'}
]
}]
});
myCheckboxGoup是一个Checkbox组件的集合,对每一个Checkbox项的访问,可能过
myCheckboxGroup.items.get(i) 定位到Checkbox 然后查看属性值 例如 myCheckboxGroup.items.get(i).inputValue
如果这种方法没有效果
可以尝试用这样的方法
myCheckboxGroup.setValue('cb-col-1', true);//设置 name为cb-col-1 的checked为true 即表选中
var field_newspwap_3 = new Ext.form.FieldSet({
title : '用户角色分配',
autoHeight : true,
collapsible : true,
id : 'field_newspwap_3',
items : [{
layout : 'column',
defaults : {
hideLabels : true,
layout : 'form'
},
items : [{
columnWidth : .01
}, {
columnWidth : .33,
items : [new Ext.form.Checkbox({
boxLabel : '计费系统',
name : 'userRole.roleIdStr',
inputValue :10,
checked : true
})]
}, {
columnWidth : .33,
items : [new Ext.form.Checkbox({
boxLabel : '演示系统',
name : 'userRole.roleIdStr',
inputValue :11,
checked : true
//disabled : true
})]
}, {
columnWidth : .33,
items : [new Ext.form.Checkbox({
boxLabel : '风格',
name : 'userRole.roleIdStr',
inputValue :12,
checked : true
// disabled : true
})]
}]
}]
});
'userRole.roleIdStr'
是映射你后台的数据类和属性。
后台得到的值是: 11, 12, 13
提交上一数据JS
var frm_newspwap = new Ext.FormPanel({
margins : '5 5 5 5',
id : 'frm_newspwap',
frame : true,
title : '新增用户',
labelAlign : 'left',
labelWidth : 160,
region : 'center',
autoScroll : true,
//bodyStyle:'overflow-x:auto;',
items : [field_newspwap_3],
buttonAlign : 'center',
buttons: [{
text:'保存',
xtype : 'easyButton',
handler:function(){// 保存操作
if (frm_newspwap.form.isValid() == false){
return;
}
frm_newspwap.form.submit({
url:'test/UserRole/save.do',
success:function(form,action){
Ext.MessageBox.alert('提示',action.result.msg);
grid_pag.doLoad(0);
},
scope:this,
failure:function(form,action){
Ext.MessageBox.alert('错误',action.result.msg);
}
})
}
}]
});
分享到:
相关推荐
今天系统中有处地方需要一个功能点击一个按钮后将树节点前的复选框去掉,变成没有选择的状态。网上搜索了半天,然后自己查查API,终于找到解决办法了,下面把方法贴出来。 在Extjs3.x和4.x版本中的处理方法是不一样...
8.5 显示行号和复选框 8.5.1 显示行号 8.5.2 引用复选框 第9章 表格的高级功能 9.1 表格视图——Ext.grid.GridView 9.2 表格分页 9.2.1 添加表格分页显示工具条 9.2.2 从后台脚本获得分页数据 9.2.3 在表格...
8.5 显示行号和复选框 8.5.1 显示行号 8.5.2 引用复选框 第9章 表格的高级功能 9.1 表格视图——Ext.grid.GridView 9.2 表格分页 9.2.1 添加表格分页显示工具条 9.2.2 从后台脚本获得分页数据 9.2.3 在表格...
五、带复选框的节点 195 六、小结 199 第二十五章:动态操作树节点 200 一、概述 200 二、基本操作 201 三、事件 203 四、小结 204 第二十六章:远程获取节点数据 205 一、 概述 205 二、异步加载解析 206 三、小结 ...
4.1.7 Ext.form.field.Checkbox复选框和Ext.form.field.Radio单选框 4.1.8 Ext.form.CheckboxGroup和Ext.form.RadioGroup 4.1.9 Ext.form.field.Trigger触发字段 4.1.10 Ext.form.field.Spinner微调字段 4.1.11 ...
-优化复选框列表和单选按钮列表,减少生成的代码量。 -修正CheckBoxList和RadioButtonList无法在回发中更新的BUG(破风、吉吉﹑落叶飞尘)。 -修正CheckBoxList和RadioButtonList初始为空时页面不能显示的BUG(e先生...
表格控件->复选框列->全选复选框列(客户端实现)。 表格控件->杂项->右键菜单(全选复选框)。 杂项->自定义回发(__doPostBack)。 杂项->自定义回发(F.customEvent)。 杂项->文本框改变客户端事件。 修正行扩展...
-优化复选框列表和单选按钮列表,减少生成的代码量。 -修正CheckBoxList和RadioButtonList无法在回发中更新的BUG(破风、吉吉﹑落叶飞尘)。 -修正CheckBoxList和RadioButtonList初始为空时页面不能显示的BUG(e先生...
-优化复选框列表和单选按钮列表,减少生成的代码量。 -修正CheckBoxList和RadioButtonList无法在回发中更新的BUG(破风、吉吉﹑落叶飞尘)。 -修正CheckBoxList和RadioButtonList初始为空时页面不能显示的BUG(e先生...
7.2.5 使用ajax处理数据的代理:ext.data.proxy.ajax与ext.data.proxy.rest / 308 7.2.6 跨域处理数据的代理:ext.data.proxy.jsonp / 312 7.2.7 为ext.direct服务的代理:ext.data.proxy.direct / 312 7.2.8 ...