zoukankan      html  css  js  c++  java
  • easyui多选与接收不一致解决方案

     附代码:

    function batchRefund(){
        	  if(editIndex != undefined) {
    	      		$('#refundList').datagrid('endEdit', editIndex);
    	      	}
              $('#refundList').datagrid('acceptChanges');
              var json = $('#refundList').datagrid('getData');
              var arr = [];
              $.each(json.rows, function(index, data){
            	  if($("input[type='checkbox']").eq(index + 1).prop('checked') == true) {
            		  console.log(data);
            		  arr.push(data);
            	  }
              })
              console.log(JSON.stringify(arr))
              if (arr.length>0) {
                  $.messager.confirm('消息提示', '确认要批量还款吗?', function(r){
                      if (r){
                    	  $.ajax({
                              type: "post",
                              url: "${webRoot}/loanManage/batchRefund.do",
                              data:{
                              	rows:JSON.stringify(arr)	//将rows数组转化为字符串,否则经过jquery的深度改造之后数据会发生改变
                              },
                              dataType: "json",
                              success: function(data){
                                   if(data.success==true){
                                        $('#refundList').datagrid('reload');
                                        $('#refundList').datagrid('unselectAll');
                                        alert("还款成功");
                                   }else{
                                        //alert("还款失败");
                                        alert(data.msg);
                                   }
                              }
                          });
                      }
                  });
                }else{
                $.messager.show({
                   title:'错误提示',
                   msg:'请选择需要还款的列',
                   timeout:5000,
                   showType:'slide'
                 });
                }
              
          }
    

      查询列表及双击编辑代码:

    $('#refundList').datagrid({
    	  	    iconCls:'icon-edit',//图标
    	  	    // 700,
    	  	    //height: 1000,
    	  	    nowrap: false,
    	  	    striped: true,
    	  	    border: true,
    	  	    collapsible:false,//是否可折叠的
    	  	    fit: true,//自动大小
    	  	    url:'${webRoot}/loanManage/refundList.do',
    	  	    //sortName: 'code',
    	  	    //sortOrder: 'desc',
    	  	    remoteSort:false,
    	  	    idField:'id',
    	  	    singleSelect:false,//是否单选
    	  	    pagination:true,//分页控件
    	  	    rownumbers:true,//行号
    	  	  	pageSize: 20,
    	  	  	pageList: [10,20,50],
    	  	  	frozenColumns:[[
    	                      {field:'ck',checkbox:true}
    	                  ]],
                onDblClickRow: function(rowIndex, rowData){
                	if(editIndex != undefined && editIndex != rowIndex) {
                		$('#refundList').datagrid('endEdit', editIndex);
                	}
                	editIndex = rowIndex;
            		$('#refundList').datagrid('selectRow', rowIndex).datagrid('beginEdit', rowIndex);
            	}
    	  	});
    

      

  • 相关阅读:
    Flink window机制
    用上帝视角来看待组件的设计模式
    npm和package.json那些不为常人所知的小秘密
    四步走查智能硬件异常Case
    PorterDuffXfermode 图像混合技术在漫画APP中的应用
    发布流程进化史
    新手入门Sqlalchemy
    OpenResty 最佳实践 (2)
    更新数据库触发器
    删除约束名字段名
  • 原文地址:https://www.cnblogs.com/knightsu/p/7388193.html
Copyright © 2011-2022 走看看