- 浏览: 777247 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (480)
- Spring (12)
- Hibernate (8)
- Struts2 (4)
- Java 基础-JDK-类-接口-URI-专题研究 (27)
- 线程、线程池、多线程高并发高可用、Socket通信 (15)
- Oracle数据库 (20)
- 一般-前端js-html-其它 (25)
- JYSK-互联网金融、金融科技、支付、公司、新闻等等 (8)
- Ajax-jQuery开源框架 (7)
- Json-轻量级的数据交换格式 (14)
- JavaScript (15)
- Jsp、Servlet、Servlet+JSP+JavaBean开发模式(MVC) (18)
- Html-JavaScript-前端-调用接口 (12)
- Sql Server 2005 (6)
- 正则表达式 (2)
- Java tools (18)
- 加签与验签、加密与解密 (3)
- Ajax技术核心-xmlHttpRequest(简称XHR) (6)
- xml-数据交换格式 (3)
- 信息采集 (1)
- Http - Https - HttpClient - httpCore-SSL-TLS (10)
- HtmlParser (2)
- 标签库 (1)
- SMS (2)
- jxl-导入导出 (4)
- poi-导入导出 (2)
- 定时器Timer+Quartz (6)
- 工作流引擎JBPM3.2.3 (4)
- 工作流引擎JBPM4 (0)
- 数据源-JNDI (0)
- tomcat、weblogic等应用服务器 (6)
- 工作流引擎jbpm5 (1)
- 搜索引擎Lucene (1)
- ant (1)
- 大数据-HBase (2)
- bigtable (0)
- 数据库设计 (4)
- jquery tab (0)
- mybatis (5)
- jquery ui 1.10.3 (5)
- Jboss7 (1)
- 规则引擎drools (0)
- 工作流引擎Activiti5 (0)
- 数据库-用户自定义函数 (0)
- 数据库-存储过程 (2)
- 数据库-视图 (0)
- 数据库-触发器 (0)
- 数据库-sql (2)
- highcharts-图表工具 (1)
- sql server 2008 (6)
- 诗词-工作室 (2)
- 数据割接 (1)
- GIS-地理信息系统 (2)
- RS-遥感技术 (1)
- GPS-全球定位系统 (1)
- java整合flex_RIA开发 (3)
- C#编程语言 (5)
- webservice_axis2_cxf_soap_wsdl (2)
- sql语句 (3)
- Flex_WebService_GIS (25)
- PHP编程语言 (0)
- ExtJS4.2 (1)
- Spring mvc (5)
- EasyUI1.4.2 (16)
- 日期时间工具类 (4)
- 随机数 (1)
- Arcgis api for js (0)
- Mysql数据库 (9)
- 移动互联网 java html5/flash socket netty (0)
- API接口 (1)
- AndroidStudio (0)
- Git (2)
- Maven (5)
- IDEA (0)
- 大数据-Hadoop (2)
- JPA (0)
- Spring boot (4)
- JSF (0)
- nginx_lua_module_redis (2)
- Activiti (1)
- bootstrap (1)
- AngularJS (10)
- 数据库-索引 (1)
- Linux及其连接工具SSH (4)
- java日志管理 (2)
- islider滑动控件 (1)
- jquery (1)
- 异常处理Exception (1)
- 秒杀与类秒杀系统 (1)
- 连接数据库、数据库连接池 (4)
- 数据库-临时表 (1)
- 软件设计模式-单例、多例、代理、工厂、观察者 (3)
- 集合框架 (5)
- 人工智能--Artificial intelligence、神经网络算法、机器学习 (1)
- 分布式应用 (1)
- SOA服务-Dubbo框架-Thrift框架 (2)
- Zookeeper分布式服务框架 (2)
- intellij idea (1)
- python编程语言 (0)
- 消息队列_MQ (0)
- 消息队列_RabbitMQ (2)
- 消息队列_ActiveMQ (1)
- 消息队列_Kafka (2)
- 缓存_Redis (4)
- 缓存_Memcache (0)
- 缓存_Ehcache (0)
- ivy-ivyde (1)
- google-protocol buffers (1)
- 正向代理-正向代理服务器 (1)
- 反向代理-反向代理服务器 (1)
- JVM内存模型 (0)
- Thunder框架 (1)
- NIO-非阻塞式IO (0)
- 软件测试、性能测试 (1)
- 序列化、Serializable接口、Externalizable接口 (3)
- 线程池-ExecutorService-ThreadPoolExecutor (1)
- web.xml (1)
- java开发-java工具-实用工具网站 (6)
- 医疗 (1)
- Filter-过滤器 (2)
- Unicode码-双字节字符编码 (1)
- OpenResty (1)
- 计算机网络 (1)
- eclipse_myeclipse_intellij idea (3)
- Enum (1)
- 大数据--Big Data (1)
- 云计算--Cloud computing (1)
- Elastic-Job (1)
- Redis (2)
- 文件流-IO操作 (6)
- 计算机基础知识 (1)
- Hessian-二进制RPC协议 (1)
- String类 (3)
- BigDecimal类 (1)
- java重要接口 (1)
- ReactJS (1)
- 跨域问题 (0)
- Map (1)
- 注解 (1)
- ASCII码-单字节字符编码 (1)
- 微服务、微服务架构 (2)
- RPC协议、RPC服务、RPC框架 (0)
- java反射 (1)
- java项目之classpath (1)
- 经典算法-树 (1)
- listener-监听器 (1)
- Interceptor-拦截器 (1)
- pojo javabean (2)
- 计算机科学与技术-进阶 (1)
- 代码规范与文档编写 (1)
- UML-统一建模语言 (1)
- 对接微信、支付宝 (3)
- 压力测试 (1)
- 办公软件-Excel (1)
- 办公软件-PPT (0)
- UTF8、GBK编码 (1)
- 微服务架构:Spring Cloud架构-Dubbo架构 (6)
- Nginx (1)
- 点滴业务 (1)
- form表单-json数据-转换与接口调用 (1)
- Junit单元测试 (1)
- 大数据-Spark (1)
- 大数据-Storm (1)
- 数据库事务-Spring事务 (0)
- elasticsearch (1)
- windows (1)
最新评论
demo1:表格和数据同步
demo1:先数据后表格
$(function() { // queryData('','','','','',1,10); // $('#gcStateId').combobox('setValue', ''); $('#gcTypeId').combobox('setValue',''); // }); // var queryByCondition=function(){ var pageopt = $('#mygrid').datagrid('getPager').data("pagination").options; queryData($("#gcCodeId").val(),$("#gcNameId").val(),$("#gcTypeId").combobox('getValue'),$("#gcStateId").combobox('getValue'),'',pageopt.pageNumber,pageopt.pageSize); } // var queryByConditionChangePagesize=function(){ var pageopt = $('#mygrid').datagrid('getPager').data("pagination").options; queryData($("#gcCodeId").val(),$("#gcNameId").val(),$("#gcTypeId").combobox('getValue'),$("#gcStateId").combobox('getValue'),'',1,pageopt.pageSize); } // function queryData(gcCode,gcName,gcType,gcState,gcAddr,pageNumberV,pageSizeV){ $('#mygrid').datagrid({ loading:false, url : sunny.contextPath + '/codeCompile/list.do', queryParams:{ pageNumber:pageNumberV, pageSize:pageSizeV, gcCode:gcCode, gcName:gcName, gcType:gcType, gcState:gcState, gcAddr:gcAddr }, striped : true, rownumbers : true, pagination : true,//分页必设 singleSelect: false, selectOnCheck: true, checkOnSelect: true, fitColumns : true, fit:true, //idField : 'gcId', //sortName : 'gcCode', //sortOrder : 'desc', pageNumber:pageNumberV, pageSize:pageSizeV, pageList : [ 5,10,20,30,50,100], frozenColumns : [ [ //固定列放置处,暂不放 ] ], toolbar : ["-",{ text: '新增', iconCls: 'icon-add', handler: function(){ addCodeFun(); } },"-",{ text: '批量审核', iconCls: 'icon-edit', handler: function(){ auditMultiCodeFun(); } },"-",{ text: '批量删除', iconCls: 'icon-remove', handler: function(){ removeMultiInfoFun(); } }], columns : [ [ { title : '主键', field : 'gcId', hidden : true }, { width : '40', title: '<input id=\"chkAllId\" type=\"checkbox\" >', field : 'codeChk', formatter: function (value, rec, rowIndex) { return "<input type=\"checkbox\" name=\"chkName\" value=\"" + rec.gcId +"_"+ rec.gcState+"\" >"; } }, { width : '120', title : '工程编码', field : 'gcCode', sortable : false }, { width : '300', title : '工程名称', field : 'gcName', sortable : false }, { width : '100', title : '工程类型', field : 'gcType', sortable : false }, { width : '120', title : '所在区域', field : 'gcArea', sortable : false } , /**暂不显示省市县2015-06-29 { width : '250', title : '县区', field : 'county', sortable:false }, * { width : '150', title : '省份', field : 'province', sortable : true } , { width : '50', title : '城市', field : 'city', sortable : true }, { width : '250', title : '县区', field : 'county', sortable:true }, { width : '150', title : '工程地址', field : 'address', sortable : true }, */ { width : '120', title : '当前状态', field : 'gcState', sortable : false, formatter:function(value,row){ return value; //alert('value:'+value); //if(value==0){ // return '已注册'; //}else if(value==1){ // return '审核通过'; //} //else if(value==2){ // return '审核未通过'; //} //else{ // //return '--'; // return value; //} } }, { width : '150', title : '列入普查名录', field : 'gcInclude', sortable : false, formatter:function(value,row){ if(value==0){ return '未列入'; }else if(value==1){ return '已列入'; } else{ return value; } } }, { title : '操作', field : 'action', formatter : function(value, row, index) { var str = ''; //if (securityUtil.havePermission("/security/user!getById")) {%> str += sunny.formatString('<img class="iconImg ext-icon-note" title="查看" onclick="showFun(\'{0}\');"/>', row.gcId); //}%> //if (securityUtil.havePermission("/security/user!update")) {%> str += sunny.formatString('<img class="iconImg ext-icon-note_edit" title="编辑" onclick="editFun(\'{0}\');"/>', row.gcId); //}%> //if (securityUtil.havePermission("/security/user!grantRole")) {%> if(row.gcState=='已注册'){ str += sunny.formatString('<img class="iconImg ext-icon-user" title="审核" onclick="auditCodeFun(\'{0}\',\'{1}\');"/>', row.gcId,row.gcState); }else{ str += sunny.formatString('<img class="iconImg ext-icon-user_gray2" title="审核" onclick="auditCodeFun(\'{0}\',\'{1}\');"/>', row.gcId,row.gcState); } //}%> //if (securityUtil.havePermission("/security/user!grantOrganization")) {%> //str += sunny.formatString('<img class="iconImg ext-icon-group" title="用户机构" onclick="grantOrganizationFun(\'{0}\');"/>', row.gcId); //}%> //if (securityUtil.havePermission("/security/user!delete")) {%> str += sunny.formatString('<img class="iconImg ext-icon-note_delete" title="删除" onclick="removeFun(\'{0}\');"/>', row.gcId); //}%> return str; } } ] ], //toolbar : '#toolbar', loadMsg:'数据加载中....', onLoadSuccess : function(data) { isDatagridEmpty_code(data.total); $(this).datagrid("fixRownumber"); $('.iconImg').attr('src', sunny.pixel_0); //全选 $("#chkAllId").unbind(); $("input[name='chkName']").unbind().bind("click", function () { var totolrows = $("input[name='chkName']").length; var checkrows = $("input[name='chkName']:checked").length; if (checkrows == totolrows) { $("#chkAllId").prop("checked",true); } else { $("#chkAllId").prop("checked", false); } }); $("#chkAllId").click(function () { if ($(this).prop('checked') == true) { $("input[name='chkName']").prop("checked", true); } else { $("input[name='chkName']").prop("checked", false); } }); // }, onDblClickRow: function (rowIndex, rowData) { showFun(rowData.gcId);//双击datagrid行事件 } }); //获取页面分页对象 var p = $('#mygrid').datagrid('getPager'); $(p).pagination({ beforePageText: '第', afterPageText: '页 共 {pages}页', displayMsg: '显示 {from}到{to} ,共 {total}条记录', onSelectPage:function (pageNumber,pageSize) { queryByCondition(); }, onChangePageSize:function (pageSize) { //queryByCondition(); queryByConditionChangePagesize(); } }); // } // var queryByConditionReset=function(){ $("#gcCodeId").val(''); $("#gcNameId").val(''); $("#gcTypeId").combobox('setValue',''); $("#gcStateId").combobox('setValue',''); //var len=$('#mygrid').datagrid('getRows').length; //if(len==0){ //$('#mygrid').datagrid('loadData', { total: 0, rows: [] });//清空下方DateGrid //} } // var searchByCondition = function(id) { parent.$.messager.confirm('系统提示', '您确定要删除此记录?', function(r) { if (r) { $.post(sunny.contextPath + '/security/user!delete.action', { id:id }, function() { //mygrid.datagrid('reload'); }, 'json'); } }); }; // function isDatagridEmpty_code(total){ var interval; var time=1000; var x=3; if(total==0){ $.messager.alert(' ','<font size=\"2\" color=\"#666666\"><strong>数据库暂无记录!</strong></font>','infoSunnyIcon',function(){ //alert('点击确定按钮才关闭');// }); $(".panel-title").append("系统提示("+x+"秒后自动关闭)"); interval=setInterval(fun,time); function fun(){ --x; if(x==0){ $(".messager-body").window('close'); } $(".panel-title").text(""); $(".panel-title").append("系统提示("+x+"秒后自动关闭)"); } } } // var removeFun = function(id) { parent.$.messager.confirm('系统提示', '您确定要删除此记录?', function(r) { if (r) { $.post(sunny.contextPath + '/codeCompile/delById.do', { id : id }, function(result) { if(result.success){ $.messager.alert('系统提示','<font size=\"2\" color=\"#666666\"><strong>删除成功!</strong></font>','successSunnyIcon',function(){queryByCondition();}); }else{ $.messager.alert('系统提示','<font size=\"2\" color=\"#666666\"><strong>删除失败!</strong></font>','errorSunnyIcon'); } }, 'json' ); } }); }; /** * 批量删除 */ var removeMultiInfoFun = function() { //只有选中至少一项时才会执行each方法 var idStr = ""; var items = $("input[name='chkName']:checked"); $.each(items, function (index, item) { var str=item.value.toString(); var ss=str.indexOf("_"); var idString=str.substring(0,ss);//gcId //var stateString=str.substr(ss+1);//gcState idStr = idString+","+idStr; }); // var checkrows = $("input[name='chkName']:checkbox:checked").length; // if(''==idStr){ $.messager.alert('系统提示','<font size=\"2\" color=\"#666666\"><strong>请至少选中一条记录,然后再来执行此操作!</strong></font>','warningSunnyIcon'); return; } parent.$.messager.confirm('系统提示', '您确定要删除这<font size=\"2\" color=\"#FF0000\"><strong>'+checkrows+'</strong></font>条记录吗?', function(r) { if (r) { $.post(sunny.contextPath + '/codeCompile/delMultiByIds.do', { ids : idStr.substring(0,idStr.length-1) }, function(result) { if(result.success){ $.messager.alert('系统提示','<font size=\"2\" color=\"#666666\"><strong>删除成功!</strong></font>','successSunnyIcon',function(){queryByCondition();}); }else{ $.messager.alert('系统提示','<font size=\"2\" color=\"#666666\"><strong>删除失败!</strong></font>','errorSunnyIcon'); } }, 'json' ); } }); }; /** * 查看信息 * @param {Object} id */ var showFun = function(id) { //if(true){alert('id='+id);return;} var dialog = parent.sunny.modalDialog({ id:'codeViewDialogId', title : '查看工程编码信息', width:650, height:300, url : sunny.contextPath + '/pages/sysmanage/code_view.jsp?codeInfoId=' + id, buttons : [ { text : '<font color=\"#000000\">取消</font>', handler : function() { //关闭本窗口 parent.$('#codeViewDialogId').dialog('close'); } } ] }); }; /** * 编辑信息 * @param {Object} id */ var editFun = function(id) { //alert('id='+id); var dialog = parent.sunny.modalDialog({ id:'codeEditDialogId', title : '编辑工程编码信息', width:650, height:330, url : sunny.contextPath + '/pages/sysmanage/code_edit.jsp?codeInfoId=' + id, buttons : [ { text : '<font color=\"#0000ff\">确定</font>', handler : function() { dialog.find('iframe').get(0).contentWindow.submitForm(dialog, mygrid, parent.$,queryByCondition); } }, { text : '<font color=\"#0000ff\">取消</font>', handler : function() { //关闭本窗口 parent.$('#codeEditDialogId').dialog('close'); } } ] }); }; /** * 审核信息 * @param {Object} id */ var auditCodeFun = function(id,gcState) { if(gcState=='已注册'){ //可以审核 var dialog = parent.sunny.modalDialog({ id:'codeAuditDialogId', title : '审核工程编码信息', width:650, height:330, url : sunny.contextPath + '/pages/sysmanage/code_audit.jsp?codeInfoId=' + id+"&gcState="+1, buttons : [ { text : '<font color=\"#000000\">确定</font>', handler : function() { dialog.find('iframe').get(0).contentWindow.submitForm(dialog, mygrid, parent.$,queryByCondition); } }, { text : '<font color=\"#000000\">取消</font>', handler : function() { //关闭本窗口 parent.$('#codeAuditDialogId').dialog('close'); } } ] }); }else{ //无法审核 var dialog = parent.sunny.modalDialog({ id:'codeAuditDialogId', title : '审核工程编码信息', width:650, height:330, url : sunny.contextPath + '/pages/sysmanage/code_audit.jsp?codeInfoId=' + id+"&gcState="+0, buttons : [ { text : '<font color=\"#000000\">取消</font>', handler : function() { //关闭本窗口 parent.$('#codeAuditDialogId').dialog('close'); } } ] }); } }; /** * 批量审核 * @param {Object} id */ var auditMultiCodeFun=function(){ var idStr = ""; var items = $("input[name='chkName']:checked"); $.each(items, function (index, item) { var str=item.value.toString(); var ss=str.indexOf("_"); var idString=str.substring(0,ss);//gcId var stateString=str.substr(ss+1);//gcState if(stateString=='已注册'){ idStr = idString+","+idStr; }else{ //do nothing } }); // if(''==idStr){ $.messager.alert('系统提示','<font size=\"2\" color=\"#666666\"><strong>请至少选中一条\"<font color=\"#ff0000\" >未审核</font>\"的记录,然后再来执行此操作!</strong></font>','warningSunnyIcon'); return; } // var dialog = parent.sunny.modalDialog({ id:'codeAuditMultiDialogId', title : '批量审核工程编码信息', width:400, height:240, url : sunny.contextPath + '/pages/sysmanage/code_multiAudit.jsp?codeInfoId=' + idStr, buttons : [ { text : '<font color=\"#000000\">确定</font>', handler : function() { dialog.find('iframe').get(0).contentWindow.submitForm(dialog, mygrid, parent.$,queryByCondition); } }, { text : '<font color=\"#000000\">取消</font>', handler : function() { //关闭本窗口 parent.$('#codeAuditMultiDialogId').dialog('close'); } } ] }); } /** * 新增 * @param {Object} id */ var addCodeFun = function() { var dialog = parent.sunny.modalDialog({ id:'codeAddDialogId', title : '新增工程编码', width:800, height:600, url : sunny.contextPath + '/pages/sysmanage/code_add.jsp', buttons : [ { text : '<font color=\"#000000\">确定</font>', handler : function() { dialog.find('iframe').get(0).contentWindow.submitForm(dialog, mygrid, parent.$,queryByCondition); } }, { text : '<font color=\"#000000\">取消</font>', handler : function() { //关闭本窗口 parent.$('#codeAddDialogId').dialog('close'); } } ] }); };
demo1:先数据后表格
var editIndexDutyVal = undefined; var dataSource=null; var dutyDataSource=null; var leaderDataSource=null; var dutyDataTreeSource=null; // $(function(){ getDataSourceFun(4,1,'2015','07','340100'); }); // function getDataSourceFun(unitIdVal,normalFlagVal,year,month,dscdVal){ $.messager.progress({ title:'系统提示', msg:'数据加载中,请稍候...' }); $.post( sunny.contextPath + '/dutyManage/toAddMonthDuty.do', { dscd:dscdVal, unitId:unitIdVal, year:year, month:month, flag:normalFlagVal //1-普通班,2-加强班 }, function(result) { var success=result.success; if(success){ dataSource=result.rows; dutyDataTreeSource=result.data0; dutyDataSource=result.data1; leaderDataSource=result.data2; //获取数据源后,紧接着渲染表格 queryDutyDataFunNew(result.title); }else{ $.messager.progress('close'); $.messager.alert('系统提示','<font size=\"2\" color=\"#666666\"><strong>'+result.info+'</strong></font>', 'warningSunnyIcon',function(){ parent.$('#monthDutyAddDialogId').dialog('close'); }); return; } }, 'json' ); } // function queryDutyDataFunNew(titleVal){ $('#mygrid').datagrid({ title:titleVal, loading:false, striped : true, rownumbers : true, pagination : false,//分页必设 singleSelect: true, selectOnCheck: false, checkOnSelect: false, fitColumns : true, fit:true, frozenColumns : [ [ //固定列放置处,暂不放 ] ], toolbar : ["-",{ text: '点击随机生成_加强班', iconCls: 'icon-randomRed', handler: function(){ addRandomStrongDuty(2); } },"-",{ text: '点击随机生成_普通班', iconCls: 'icon-randomYellow', handler: function(){ addRandomStrongDuty(1); } }], columns : [ [ { title : '主键', align:'center', styler: function(value,row,index){ return 'vertical-align:middle;'; }, field : 'dutyId', hidden : true }, { width : '70px', title : '日期', align:'center', styler: function(value,row,index){ return 'vertical-align:middle;'; }, field : 'day', sortable : false }, { width : '50px', title : '星期', align:'center', styler: function(value,row,index){ return 'vertical-align:middle;'; }, field : 'weekDay', sortable : false }, { width : '220px', title : '上午', align:'center', styler: function(value,row,index){ return 'vertical-align:middle;'; }, field : 'morningPeopleIds', sortable : false, formatter:function(value,row){ return row.morningPeopleNames; }, editor:{ type:'combotree', options:{ cascadeCheck:true, data: dutyDataTreeSource, valueField:'id', textField:'text', multiple:true, panelHeight:'auto', editable: false, onlyLeafCheck:true, required:false } } }, { width : '220px', title : '下午', align:'center', styler: function(value,row,index){ return 'vertical-align:middle;'; }, field : 'afternoonPeopleIds', sortable : false, formatter:function(value,row){ return row.afternoonPeopleNames; }, editor:{ type:'combotree', options:{ cascadeCheck:true, data: dutyDataTreeSource, valueField:'id', textField:'text', multiple:true, panelHeight:'auto', editable: false, onlyLeafCheck:true, required:false } } } , { width : '220px', title : '晚上', align:'center', styler: function(value,row,index){ return 'vertical-align:middle;'; }, field : 'eveningPeopleIds', sortable : false, formatter:function(value,row){ return row.eveningPeopleNames; }, editor:{ type:'combotree', options:{ cascadeCheck:true, data: dutyDataTreeSource, valueField:'id', textField:'text', multiple:true, panelHeight:'auto', editable: false, onlyLeafCheck:true, required:false // onSelect:function(node){ // var tree = $(this).tree; // var isLeaf = tree('isLeaf', node.target); // if (!isLeaf) { // $(this).combotree('clear'); // } //} } } },{ width : '160px', title : '带班领导', align:'center', styler: function(value,row,index){ return 'vertical-align:middle;'; }, field : 'leaderIds', sortable : false, formatter:function(value,row){ return row.leaderNames; }, editor:{ type:'combobox', options:{ data:leaderDataSource, valueField:'personId', textField:'personName', multiple:true, panelHeight:'auto', required:false } } } //,{ // width : '40%', // title : '备注', // field : 'remark', // sortable : false //} ] ], //toolbar : '#toolbar', loadMsg:'数据加载中....', onBeforeRender: function(target, rows){ //alert('2'); //$.each(rows,function(index,row){ // alert("row"+row.data0); // dutyDataSource=row.data1; // leaderDataSource=row.data2; // return false; // }); }, onLoadSuccess : function(data) { $.messager.progress('close'); if(null!=data){ mergeCellsFun(data); } // // $(this).datagrid("fixRownumber"); $('.iconImg').attr('src', sunny.pixel_0); }, rowStyler:function(index,row){ if (row.weekDay=='星期六'||row.weekDay=='星期日'){ return 'background-color:#ccffff;'; } }, onDblClickRow: function (rowIndex, rowData) { //showFun(rowData.gcId);//双击datagrid行事件 }, onClickRow: function (index, rowData) { //单击事件 if (editIndexDutyVal != index){ if (endEditing()){ //开始编辑状态=beginEdit editIndexDutyVal = index; $('#mygrid').datagrid('selectRow', index).datagrid('beginEdit', index); } else { $('#mygrid').datagrid('selectRow', editIndexDutyVal); } }else{ } } }); //绑定数据 if(null!=dataSource){ $('#mygrid').datagrid('loadData', dataSource); } } // function submitMonthDutyForm($dialog, $mygrid, $pjq,$selectTabByIndex){ $.messager.progress({ title:'系统提示', msg:'数据加载中,请稍候...' }); var rows = $('#mygrid').datagrid("getRows"); //post $.post( sunny.contextPath + '/dutyManage/addMonthDutyIntoDB.do', { data:JSON.stringify(rows) }, function(result) { $.messager.progress('close'); var success=result.success; if(success){ $.messager.alert('系统提示','<font size=\"2\" color=\"#666666\"><strong>'+result.info+'</strong></font>', 'warningSunnyIcon',function(){ parent.$('#monthDutyAddDialogId').dialog('close'); }); }else{ $.messager.alert('系统提示','<font size=\"2\" color=\"#666666\"><strong>'+result.info+'</strong></font>', 'warningSunnyIcon',function(){ parent.$('#monthDutyAddDialogId').dialog('close'); }); } }, 'json' ); } /** * 预新增 * @param {Object} id */ var addInfoFun_duty = function() { var dialog = parent.sunny.modalDialog({ id:'monthDutyAddDialogId', title : '添加月度排班', width:1000, height:600, url : sunny.contextPath + '/pages/duty/monthDuty_add.jsp', buttons : [ { text : '<font color=\"#000000\">确定</font>', handler : function() { dialog.find('iframe').get(0).contentWindow.submitMonthDutyForm(dialog, mygrid_main_Id, parent.$,selectTabByIndex); } }, { text : '<font color=\"#000000\">取消</font>', handler : function() { //关闭本窗口 parent.$('#monthDutyAddDialogId').dialog('close'); } } ], onClose:function(){ if(null==leaderDataSource){ selectTabByIndex(); } parent.$('#monthDutyAddDialogId').dialog('destory'); }, onLoad:function(){ } }); } // function isDatagridEmpty_duty_add(total){ var interval; var time=1000; var x=3; if(total==0){ $.messager.alert(' ','<font size=\"2\" color=\"#666666\"><strong>数据库暂无记录!</strong></font>','infoSunnyIcon',function(){ //alert('点击确定按钮才关闭');// }); $(".panel-title").append("系统提示("+x+"秒后自动关闭)"); interval=setInterval(fun,time); function fun(){ --x; if(x==0){ $(".messager-body").window('close'); } $(".panel-title").text(""); $(".panel-title").append("系统提示("+x+"秒后自动关闭)"); } } } // function endEditing(){ if (editIndexDutyVal ==undefined){ return true; } if ($('#mygrid').datagrid('validateRow', editIndexDutyVal)){ var ed0 = $('#mygrid').datagrid('getEditor', {index:editIndexDutyVal,field:'morningPeopleIds'}); var morningPeopleNames = $(ed0.target).combotree('getValue'); $('#mygrid').datagrid('getRows')[editIndexDutyVal]['morningPeopleIds'] = morningPeopleNames; // var ed1 = $('#mygrid').datagrid('getEditor', {index:editIndexDutyVal,field:'afternoonPeopleIds'}); var afternoonPeopleNames = $(ed1.target).combotree('getValue'); $('#mygrid').datagrid('getRows')[editIndexDutyVal]['afternoonPeopleIds'] = afternoonPeopleNames; // var ed2 = $('#mygrid').datagrid('getEditor', {index:editIndexDutyVal,field:'eveningPeopleIds'}); var eveningPeopleNames = $(ed2.target).combotree('getValue'); $('#mygrid').datagrid('getRows')[editIndexDutyVal]['eveningPeopleIds'] = eveningPeopleNames; // var ed3 = $('#mygrid').datagrid('getEditor', {index:editIndexDutyVal,field:'leaderIds'}); var leaderNames = $(ed3.target).combobox('getText'); $('#mygrid').datagrid('getRows')[editIndexDutyVal]['leaderIds'] = leaderNames; // $('#mygrid').datagrid('endEdit', editIndexDutyVal); editIndexDutyVal = undefined; return true; } else { return false; } } // function addRandomStrongDuty(val){ editIndexDutyVal = undefined; dataSource=null; dutyDataSource=null; leaderDataSource=null; dutyDataTreeSource=null; getDataSourceFun(4,val,'2015','07','340100'); } // function mergeCellsFun(data){ var mark = 0; //var rowspan_field = 'name'; var colspan_field = 'morningPeopleIds'; var colspan_field2 = 'afternoonPeopleIds'; for (var i=0; i <data.rows.length; i++) { if (data.rows[i][colspan_field] == data.rows[i][colspan_field2]) { $('#mygrid').datagrid('mergeCells',{ index: i, field: colspan_field, colspan:2 }); } } }
发表评论
-
Easyui tree 异步加载
2016-06-01 10:21 14601、效果图 【图1】 【图2】 2、js代码 $(f ... -
easyui datagrid 动态表头 动态columns 的一种实现方式
2016-05-23 18:09 9353function doUpgradeDataQueryFu ... -
easyui datagrid数据查询
2016-05-18 13:56 878function doFirstQueryFun(){ ... -
easyui datebox formatter parser
2015-10-13 15:42 1458//年月日 function myformatter(dat ... -
amcharts与easyui datagrid实现值班数量统计
2015-09-11 15:37 1719效果: 代码: <script> var ... -
easyui datagrid rowedit点击编辑行
2015-08-27 11:14 1689onClickRow: function (index, r ... -
easyui dialog 修改title
2015-08-25 19:47 1337方式一: parent.$('#monthDutyAddDi ... -
easyui dialog关闭窗口最好使用destroy而不推荐使用close
2015-08-24 16:05 2721http://blog.csdn.net/maosijunzi ... -
easyui messager alert 3秒后自动关闭提示
2015-08-20 10:24 2263function isDatagridEmpty_duty( ... -
easyui datagrid 前台批量传递数据到后台_json
2015-08-19 09:28 2016前台: var rows = $('#mygrid ... -
easyui dialog 子窗口jsp(被弹出窗口)调用父jsp页面方法操作父jsp
2015-08-14 18:08 14465父jsp(monthDuty.jsp'): <scrip ... -
easyui datagrid loadFilter loadData
2015-08-05 17:10 1475不使用loadFilter(弄了半天没反应),直接使用load ... -
easyui messager show和confirm
2015-07-10 17:32 2194//show var sho ... -
jquery easui tabs注册完刷新另一个tabs
2015-07-10 16:21 847========思路:没有的话直接添加,自动刷新;有的话先关闭 ... -
easyui datagrid pagination 自定义分页
2015-07-09 10:56 8137//============================= ...
相关推荐
jquery easyui demo 网页下载下来打包了,还有datagrid简要说明
easyui的datagrid的数据渲染
easyui datagrid表格打印,支持formatter格式化数据的打印,还原的最初datagrid 的表格数据
easyui datagrid中实现上下左右、回车切换单元格easyui datagrid中实现上下左右、回车切换单元格easyui datagrid中实现上下左右、回车切换单元格
一个update扩展方法 文档中一种是比较笨的方法 一次只能修改一个列而且受列编辑类型影响(比如number datetime)扩展一次编辑多列,不受编辑类型影响,没有编辑属性也可以。
JS EasyUI DataGrid动态加载数据
EasyUI DataGrid过滤用法实例
easyui datagrid editor回车切换单元格示例,适合熟悉easyui但又不懂如何做的人员,可能参考一下源码JS。
两种方法将easyui datagrid 中的数据导出到Excel中,均以验证可以正常使用
easyUI datagrid 自动调整行号大小
jQuery EasyUI Datagrid 用户列表鼠标悬停/离开数据行时显示人员头像(onMouseOver/onMouseOut) Demo 扩展 jQuery EasyUI Datagrid 数据行鼠标悬停离开事件,源码奉献!!!
easyui datagrid 嵌套datagrid form 简单提交 ,刷新子表数据
jquery easyui 扩展 datagrid 自定义动态隐藏显示列
easyUI datagrid 行上移,下移,置顶,置底的方法
easyui datagrid 多条件筛选 可复选 过滤 例如过滤200-300 500-600 类似淘宝筛选 但允许复选
解决EasyUIdataGrid列比较多,无数据,列展现不全
在easyui 的datagrid编辑状态下实时更新其他处于编辑或者没在编辑下的列值,并在结束编辑后得到的row的数据为更改后的数据。
使用SSM框架+EasyUI DataGrid数据表格实现了基本的增删改查,以及对数据分页,排序功能的实现。是一个对于后台管理的很好的例子,因为一般企业后台管理都是使用EasyUI等框架快速搭建,而且DataGrid是EasyUI最重要的...
jquery easyui datagrid demo 详解 增删改查