列表形式表单面板的设计
1.表单:注意column布局和form布局的结合使用
/*-----1.创建表单-----*/ var basicMsgForm = new Ext.form.FormPanel({ width : 550, autoHeight : true, frame : true, layout : "form", // 整个大的表单是form布局 buttonAlign : "center", labelAlign:"right", labelWidth : 80, items : [{ // 行1 layout : "column", // 从左往右的布局 items : [{ columnWidth : .34, // 该列有整行中所占百分比 layout : "form", // 从上往下的布局 items : [{ name:"xmfzr", xtype : "textfield", fieldLabel : "项目负责人", width : 90 },{ id:"basicId", name:"id", xtype:"textfield", fieldLabel:"编号", hidden:true, hideLabel:true },{ id:"basicXmid", name:"xmid", xtype:"textfield", fieldLabel:"项目编号", hidden:true, hideLabel:true }] }, { columnWidth : .33, layout : "form", items : [{ name:"tel", xtype : "textfield", fieldLabel : "联系方式", width : 90 }] },{ columnWidth : .3, layout : "form", items : [{ name:"yzbm", xtype : "textfield", fieldLabel : "邮政编码", width : 60 }] }] }, { // 行2 layout : "column", items : [{ layout : "form", items : [{ name:"addr", xtype : "textfield", fieldLabel : "联系地址", width : 420 }] }] }, {// 行3 layout : "column", items : [{ layout:"form", columnWidth:.5, items:[{ name:"start_date", xtype:"datefield", fieldLabel:"项目开始时间", readOnly :true, format : 'Y-m-d', width:150 }] },{ layout:"form", columnWidth:.5, items:[{ name:"end_date", xtype:"datefield", fieldLabel:"项目结束时间", readOnly:true, format:"Y-m-d", width:150 }] }] }, {// 行4 layout : "column", items : [{ layout : "form", columnWidth : .5, items : [{ name:"plan_fund", xtype : "textfield", fieldLabel : "计划安排资金", width : 150 }] }, { layout : "form", columnWidth : .5, items : [{ name:"actual_fund", xtype : "textfield", fieldLabel : "实际到位资金", width : 150 }] }] }, {// 行4 layout : "column", items : [{ layout : "form", columnWidth : .5, items : [{ name:"central_pfund", xtype : "textfield", fieldLabel : "中央财政", width : 150 }] }, { layout : "form", columnWidth : .5, items : [{ name:"central_afund", xtype : "textfield", fieldLabel : "中央财政", width : 150 }] }] }, {// 行4 layout : "column", items : [{ layout : "form", columnWidth : .5, items : [{ name:"province_pfund", xtype : "textfield", fieldLabel : "省财政", width : 150 }] }, { layout : "form", columnWidth : .5, items : [{ name:"province_afund", xtype : "textfield", fieldLabel : "省财政", width : 150 }] }] }, {// 行4 layout : "column", items : [{ layout : "form", columnWidth : .5, items : [{ name:"county_pfund", xtype : "textfield", fieldLabel : "县财政", width : 150 }] }, { layout : "form", columnWidth : .5, items : [{ name:"county_afund", xtype : "textfield", fieldLabel : "县财政", width : 150 }] }] }, {// 行4 layout : "column", items : [{ layout : "form", columnWidth : .5, items : [{ name:"other_pfund", xtype : "textfield", fieldLabel : "其他", width : 150 }] }, { layout : "form", columnWidth : .5, items : [{ name:"other_afund", xtype : "textfield", fieldLabel : "其他", width : 150 }] }] },{ layout:"column", items:[{ layout:"form", columnWidth : .5, items:[{ name:"actual_cost", xtype:"textfield", fieldLabel:"实际支出", width:150 }] },{ layout:"form", columnWidth : .5, items:[{ xtype:"textfield", fieldLabel:"【单位】", value:"( 万元 )", width:150, style:"background:none;border:0px;color:blue;font-weight:bold;", labelStyle:"color:blue;font-weight:bold;" }] }] }], buttons : [{ text : "确认", handler:function(){ var thisForm = basicMsgForm.getForm(); if(thisForm.isValid()){ var submitValues = thisForm.getValues(); //提交表单 thisForm.submit({ url:"insertBasicInfo.eva?doType=insertBasicInfo", method:"POST", waitMsg:"保存中,请稍后...", params:submitValues, success:function(){ Ext.Msg.alert('成功', "更新项目绩效基本情况成功!"); basicStore.reload(); }, failure:function(form,action){ Ext.Msg.alert('失败', "保存项目绩效基本情况失败!"); } }); } } },{ text:"取消", handler:function(){ basicMsgWin.hide(); } }] });
2.窗口:
/*-----2.创建窗口-----*/ var basicMsgWin = new Ext.Window({ title:"项目基本情况", layout:"fit", closeAction:"hide", modal:true, items:basicMsgForm });
3.Store:
var basicStore = new Ext.data.JsonStore({ url:"getBasicInfo.eva?doType=getBasicInfo", root:"data", fields:["id","xmid","xmfzr","tel","addr","yzbm","startDate","endDate", "planFund","actualFund","centralPfund","centralAfund","provincePfund", "provinceAfund","countyPfund","countyAfund","otherPfund","otherAfund", "actualCost"] }); //加载结束后执行,把Store的值赋给Form表单 basicStore.on("load",function(){ var basicForm = basicMsgForm.getForm(); var basicRecords = basicStore.data; //获取Records记录 var basicData = basicRecords.get(0); //获取某一行的Record的Data数据 basicForm.findField("id").setValue(basicData.get("id")); basicForm.findField("xmid").setValue(basicData.get("xmid")); basicForm.findField("xmfzr").setValue(basicData.get("xmfzr")); basicForm.findField("tel").setValue(basicData.get("tel")); basicForm.findField("yzbm").setValue(basicData.get("yzbm")); basicForm.findField("addr").setValue(basicData.get("addr")); basicForm.findField("start_date").setValue(basicData.get("startDate")); basicForm.findField("end_date").setValue(basicData.get("endDate")); basicForm.findField("plan_fund").setValue(basicData.get("planFund")); basicForm.findField("actual_fund").setValue(basicData.get("actualFund")); basicForm.findField("central_pfund").setValue(basicData.get("centralPfund")); basicForm.findField("central_afund").setValue(basicData.get("centralAfund")); basicForm.findField("province_pfund").setValue(basicData.get("provincePfund")); basicForm.findField("province_afund").setValue(basicData.get("provinceAfund")); basicForm.findField("county_pfund").setValue(basicData.get("countyPfund")); basicForm.findField("county_afund").setValue(basicData.get("countyAfund")); basicForm.findField("other_pfund").setValue(basicData.get("otherPfund")); basicForm.findField("other_afund").setValue(basicData.get("otherAfund")); basicForm.findField("actual_cost").setValue(basicData.get("actualCost")); });
注意在点击弹框时传递需要的ID:
...... <button class='btn1' onclick='showCostWin("+record.get("xmid")+")'>查看</button> ...... //显示收支明细窗口 function showCostWin(xmid){ Ext.getCmp("costXmid").setValue(xmid);//传递ID costWin.show(); costStore.baseParams.xmid = xmid; costStore.load(); }
4.实体类:
public class ProjectBasicInfo { private int id; private int xmid; private String xmfzr; private String tel; private String addr; private String yzbm; private Date startDate; private Date endDate; private String planFund; private String actualFund; private String centralPfund; private String centralAfund; private String provincePfund; private String provinceAfund; private String countyPfund; private String countyAfund; private String otherPfund; private String otherAfund; private String actualCost; 。。。。。。set/get方法省略 }
5.插入数据的Servlet:(注意日期格式的转换,必须为YYYY-mm-dd才行)
ProjectBasicInfoDao dao = new ProjectBasicInfoDao(); ProjectBasicInfo basicInfo = new ProjectBasicInfo(); String id = request.getParameter("id"); if(id != null && !id.equals("")){ basicInfo.setId(Integer.valueOf(id)); } basicInfo.setXmid(Integer.valueOf(request.getParameter("xmid"))); basicInfo.setXmfzr(request.getParameter("xmfzr")); basicInfo.setTel(request.getParameter("tel")); basicInfo.setYzbm(request.getParameter("yzbm")); basicInfo.setAddr(request.getParameter("addr")); String startDate = request.getParameter("start_date"); String endDate = request.getParameter("end_date"); if(startDate != null && !startDate.equals("")){ basicInfo.setStartDate(Date.valueOf(startDate)); } if (endDate != null && !endDate.equals("")) { basicInfo.setEndDate(Date.valueOf(endDate)); } basicInfo.setPlanFund(request.getParameter("plan_fund")); basicInfo.setActualFund(request.getParameter("actual_fund")); basicInfo.setCentralPfund(request.getParameter("central_pfund")); basicInfo.setCentralAfund(request.getParameter("central_afund")); basicInfo.setProvincePfund(request.getParameter("province_pfund")); basicInfo.setProvinceAfund(request.getParameter("province_afund")); basicInfo.setCountyPfund(request.getParameter("county_pfund")); basicInfo.setCountyAfund(request.getParameter("county_afund")); basicInfo.setOtherPfund(request.getParameter("other_pfund")); basicInfo.setOtherAfund(request.getParameter("other_afund")); basicInfo.setActualCost(request.getParameter("actual_cost")); dao.addProjectBadicInfo(basicInfo);
6.Hibernate插入或更新数据方法:
/** * 插入或更新项目基本信息 * @param projectBasicInfo */ public void addProjectBadicInfo(ProjectBasicInfo projectBasicInfo) { Session s = null; try { s = HibernateUtil.getSession(); s.beginTransaction(); s.saveOrUpdate(projectBasicInfo); s.getTransaction().commit(); } catch (Throwable e) { logger.error(e.toString()); HibernateUtil.endSession(s); } finally { HibernateUtil.endSession(s); } }
7.后台获取Store数据的代码:
查看另一篇博文:http://zyjustin9.iteye.com/admin/blogs/2121569
相关推荐
"9.2 Visual FoxPro中的类 " "6.3.4 添加页框和列表框控件 "9.2.1 类的分类 " "6.4 美化表单 "9.2.2 创建类 " "6.4.1 设置表单外观 "9.2.3 编辑类 " "6.4.2 设置表单中的控件 "9.3 面向对象程序设计的一般过程 ...
主题默认是远方的雪山效果,可以设置成博客形式,公告、画廊、视频不使用可以不开启、商城、积分和用户中心不安装插件就不加载相关的程序。 更新日期:2018.01.02,版本:2.2 本次更新,首页所有分类列表需要重新...
该插件还提供了一个易于使用的面板,使用户可以在继续工作的同时随时访问其应用程序 Oracle身份云服务是一种云原生身份管理服务。它为Oracle Cloud和客户应用程序提供身份管理和安全性 “通过安装Oracle Identity ...
本书共分17章,分别介绍了JavaScript的对象编程、JavaScript浏览器对象模型和事件机制、ExtJS的核心类库和组件、ExtJS的事件处理方式、设计进度条、设计工具栏和菜单栏、设计面板、设计表格、设计表单、设计数据表、...
本书共分17章,分别介绍了JavaScript的对象编程、JavaScript浏览器对象模型和事件机制、ExtJS的核心类库和组件、ExtJS的事件处理方式、设计进度条、设计工具栏和菜单栏、设计面板、设计表格、设计表单、设计数据表、...
3-动态面板.mp4 4-创建部件库.mp4 5-交互设置.mp4 6-变量.mp4 7-Web案例1.mp4 8-Web案例2.mp4 9-手机原型案例.mp4 PM的3大文档.xmind 2流程图 1-流程图基础.mp4 2-要关注的流程图.mp4 3-要绘制的流程图....
但是,如果在设计时刻 Scrollbars 属性设置为非 0 值,Visual FoxPro 就会允许在运行时刻对 Scrollbars 属性进行读写,因为有代码可调用 SAVEAS() 函数以创建一个带有滚动条的新表单。如果您不需要带滚动条的表单...
免费版本包括所有Material UI组件,表单元素和验证,JWT身份验证,登录,注册页面,垂直导航,延迟加载,代码拆分,SASS集成。 特征 JWT认证 基于角色的身份验证 延迟加载组件 代码拆分 仪表盘分析 UI工具包 自动...
9.8 将12343778转成12.343.778的形式 9.9 模拟抽奖程序 9.10 实现冒泡算法 9.11 查询数组中特定数值 9.12 从数组中移除特定数值 9.13 根据指定正则表达式识别超链接 9.14 验证Email地址的正确性 9.15 动态统计字符个...
994 重新设计项目列表的折叠和隐藏功能 986 批量添加的时候,将input改为textarea 981 调整各个对象编辑页面的标题文本框的排版 979 调整测试任务的详情页面,和其他的详情页面保持一致 971 将扩展编辑器放在...
1、定义任意形式的工作流程 国讯OA强大的自定义功能可以满足企业对复杂工作流程的定义,包括请假审批流程和工单管理流程。 2、工作流执行 可设定的对工作流的执行包括提交、批准、退回、拒绝、代理、重新打开、归档...
Site2U(建站任我行)网站建设**台是一种可以综合管理网站应用上各种栏目的通用工具,新闻、产品、文档、下载、编辑、用户、论坛……,借助通用模板技术和独创的infoInsert技术,这些不同形式的信息都在同一套系统里...
2.6. 皮肤设计指南 2.7. 关于二次开发 2.1. 进阶使用指导 阅读本章节请先阅读:xhEditor入门基础,若你已经熟悉xhEditor的基本使用,请往下继续。 xhEditor提供两种方式初始化编辑器: 方法1:利用class属性来...
实例079 利用TStringGrid实现表单式批量录入数据 96 实例080 在TStringGrid中实现单元格下拉列表 98 实例081 在TStringGrid组件中绘图 99 实例082 TStringGrid组件上回车移动焦点 100 实例083 在...
jQuery EasyUI 提供了用于创建跨浏览器网页的完整的组件集合,包括功能强大的 datagrid(数据网格)、treegrid(树形表格)、 panel(面板)、combo(下拉组合)等等。 用户可以组合使用这些组件,也可以单独使用其中一个。 ...
采用统一的数据库处理类,页面构造类,表单构造类,处理效率极大提高, 免费给任何下载此软件的个人和团体使用,但必须保留本代码的版权标记. CC工作室坚决拥护WTO以及国务院关于软件保护的相关法律、条例,支持正版软件...
Message-Driven Bean EJB实例源代码,演示一个接收购物订单的消息驱动Bean,处理这个订单同时通过e-mail的形式 //给客户发一个感谢消息,消息驱动Bean必须实现两个接口MessageDrivenBean和MessageListener 在...
Message-Driven Bean EJB实例源代码,演示一个接收购物订单的消息驱动Bean,处理这个订单同时通过e-mail的形式 //给客户发一个感谢消息,消息驱动Bean必须实现两个接口MessageDrivenBean和MessageListener 在...
Message-Driven Bean EJB实例源代码,演示一个接收购物订单的消息驱动Bean,处理这个订单同时通过e-mail的形式 //给客户发一个感谢消息,消息驱动Bean必须实现两个接口MessageDrivenBean和MessageListener 在...
Message-Driven Bean EJB实例源代码,演示一个接收购物订单的消息驱动Bean,处理这个订单同时通过e-mail的形式 //给客户发一个感谢消息,消息驱动Bean必须实现两个接口MessageDrivenBean和MessageListener 在...