Extjs combox和checkboxgroup组合案例以及参数提交
2011-06-27 17:42
295 查看
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="http://zhangwei12hao.blog.163.com/blog/<%=basePath%>"> <title>My JSP 'pzxf_operations.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <link rel="stylesheet" type="text/css" href="http://zhangwei12hao.blog.163.com/blog/../javascript/library/extjs/resources/css/ext-all.css" mce_href="http://zhangwei12hao.blog.163.com/blog/../javascript/library/extjs/resources/css/ext-all.css"> <mce:script type="text/javascript" src="http://zhangwei12hao.blog.163.com/blog/../javascript/library/extjs/adapter/ext/ext-base.js" mce_src="http://zhangwei12hao.blog.163.com/blog/../javascript/library/extjs/adapter/ext/ext-base.js"></mce:script> <mce:script type="text/javascript" src="http://zhangwei12hao.blog.163.com/blog/../javascript/library/extjs/ext-all.js" mce_src="http://zhangwei12hao.blog.163.com/blog/../javascript/library/extjs/ext-all.js"></mce:script> <mce:script type="text/javascript"><!-- Ext.onReady(function(){ var myCheckboxItems = []; var myCheckboxGroup; var stationstore = new Ext.data.Store({//用于下拉框 proxy: new Ext.data.HttpProxy({ url: "/Elements", method: "POST" }), reader: new Ext.data.JsonReader({ root: "" }, [ {name: "id", }, {name: "name"} ]) }); stationstore.on("beforeload", function(sto, opt) { sto.baseParams.query = 'Station'; sto.baseParams.parentid = 'admin_station'; }); var store= new Ext.data.Store({//用于填充checkboxgroup proxy: new Ext.data.HttpProxy({url:'/All'}), reader: new Ext.data.JsonReader({ root:'' },[{ name:'id' },{ name:'name' }]) }); store.load( { params:{query:'OperationType'} } );//load store.on('load',function(){ for(var i=0;i<store.getCount();i++){ var boxLabel = store.getAt(i).get("name"); var name = store.getAt(i).get("id"); myCheckboxItems.push({ boxLabel : boxLabel, name : name }) } var columNum=3; //设置checkbox的列数,默认是3 if(columNum<3) //如果checkbox个数小于3时,列的长度设成checkbox个数 columNum=comData.length; myCheckboxGroup = new Ext.form.CheckboxGroup({ name:'operationShow', xtype : 'checkboxgroup', columns:columNum, items : myCheckboxItems }); var stationForm=new Ext.form.FormPanel({ labelAlign:'right', labelWidth:60, title:'配置下发', frame:true, width:650, method:"post", url:'/Update', items:[{ layout:'column', items:[{ columnWidth:.95, layout:'form', items:[{ id:'station', xtype:'combo', width:150, fieldLabel:'网点名称', emptyText:'请选择网点', name:'station_id', mode: 'remote', typeAhead: true, store: stationstore,//store*/ triggerAction: 'all', forceSelection: true, displayField: 'name', hiddenName:'id', valueField: 'id', labelSeparator: ':' },{ xtype:'fieldset', title:'业务内容', name:'operations', fieldLabel:'可选业务', width:599, items:[myCheckboxGroup] },{ xtype:'textfield', fieldLabel:'测试2', width:150 },{ xtype:'hidden', name:'query', value:'Station' }] }] }], buttons:[{ text:'提交', handler:sub_button }] });//stationForm stationForm.render('body'); function sub_button(){ var opes3=""; var opes2='['; var opera=stationForm.getForm().findField("operationShow").getValue(); for(var i=0;i<opera.length;i++){ opes2=opes2+opera[i].name+','; } opes3 = opes2.substring(0, opes2.length-1)+']'; stationForm.getForm().submit({ //当提交时执行 method:"post", url:'/Update', params:{ operations:opes3 }, success:function(){ Ext.Msg.alert("提示",'您成功的提交信息'); }, failure:function(){ Ext.Msg.alert("信息","对不起,您提交信息失败"); } }); };// sub_button });//on }); // --></mce:script> </head> <body> <div id="body"></div> <!-- <div id="hello"></div> --> </body> </html>
本文链接地址为:http://zhangwei12hao.blog.163.com/blog/static/240030432011464157285/
相关文章推荐
- ExtJS4——Button/override/NumberField/Hidden/DateField/RadioGroup/CheckboxGroup/ComboBox
- EXTJS 4.2 资料 控件之checkboxgroup的用法(静态数据)
- Springmvc重定向参数以及表单提交问题的认识
- Jquery+Ajax实现checkbox多选参数提交
- 一个简单的Httpserver以及获取post提交的参数
- Android学习笔记---27_网络通信之通过GET和POST方式提交参数给web应用,以及使用httpClient,来给web项目以post方式发送参数
- Extjs 4.2 动态加载checkboxgroup
- 使用<a>标签提交表单数据的问题以及获取session作为函数的参数调用的问题
- android中canvas.drawText参数的介绍以及绘制一个文本居中的案例
- Extjs练习——服务器端获取信息填充客户端表单,注意Radio以及Checkbox值的传递
- Extjs 3根据数据库动态生成checkboxgroup(extjs系列1)
- 关于extjs checkboxgroup 数据修改时候数据匹配加载
- 工作记录1:extJS-checkboxgroup复选框和combo联动
- extjs 初始化checkboxgroup值的代码
- ExtJS 获取复选框的值 checkboxgroup 获取值 fieldset(checkbox) 获取值
- Andriod自定义View二:canvas.drawText参数的介绍以及绘制一个文本居中的案例
- 无废话ExtJs 入门教程二十二[动态复选框:RemoteCheckboxGroup]
- extjs 初始化checkboxgroup值的代码
- android中canvas.drawText参数的介绍以及绘制一个文本居中的案例
- extjs treepanel checkbox得到所选的参数,浏览器不兼容的解决办法