zoukankan      html  css  js  c++  java
  • datagrid合并行列--并不能影响序号列内容...(formatter的锅.)

    datagrid合并行列

        //datagrid组件.
        $('#id_dailylist_dg').datagrid({
            //url:'datagrid_data.json',
            columns:[[
                {field:'orderNum',title:'序号','5%',align:'center',
    	            formatter:function(value,row,index){return index+1;}},
                {field:'TYPENAME',title:'类别名称','10%',align:'center'},
                {field:'YZ_CONTENT',title:'名称','20%',align:'center'},
                {field:'SPEC',title:'规格','18%',align:'center'},
                {field:'SELLNUM',title:'数量','8%',align:'center'},
                {field:'TOTALPRICE',title:'金额','10%',align:'center'},
                {field:'COSTTYPE',title:'费用类型','7%',align:'center'}
            ]]
        });
    

      

    		            $.ajax({
    		        		type:'POST',
    		        		url: ctx+"dailyListInfo/queryDailyDetail.do",
    		        		data:{'adRegNum':adregnum,'date':date_str},
    		        		cache:false,
    		        		async:true,
    		        		dataType:'json',
    		        		success: function(result2)
    		        		{
    		        			if(!!result2 && result2.length > 0){
    		        				$('#id_dailylist_dg').datagrid("loadData", result2);
    		        			}
    		        			//$('#id_dailylist_dg').datagrid("loadData", result2);
    		        			$('#id_dailylist_dg').datagrid("appendRow",{orderNum: '汇总:',YZ_CONTENT: '1112222次'});
    		        			$('#id_dailylist_dg').datagrid("appendRow",{orderNum: '汇总',YZ_CONTENT: ''});
    		        			
    		        			var rows = $('#id_dailylist_dg').datagrid("getRows");
    		        			console.log( rows.length-2 );
    		        			$('#id_dailylist_dg').datagrid('mergeCells', {
    		        				index: rows.length-2,
    		        				field: 'orderNum',
    		        				rowspan: 2,
    		        				colspan: 2
    		        			});
    		        			$('#id_dailylist_dg').datagrid('mergeCells', {
    		        				index: rows.length-2,
    		        				field: 'YZ_CONTENT',
    		        				rowspan: 2,
    		        				colspan: 5
    		        			});
    		        			console.log("rows.length", rows.length );
    		        			
    		        			
    		        	    },error:function(result2)
    		        	    {
    		        	    }
    		        	});
    

    去掉 formatter:function(value,row,index){return index+1;}  后,就可以了.

        //datagrid组件.
        $('#id_dailylist_dg').datagrid({
            //url:'datagrid_data.json',
            columns:[[
                {field:'orderNum',title:'序号','5%',align:'center'},
                {field:'TYPENAME',title:'类别名称','10%',align:'center'},
                {field:'YZ_CONTENT',title:'名称','20%',align:'center'},
                {field:'SPEC',title:'规格','18%',align:'center'},
                {field:'SELLNUM',title:'数量','8%',align:'center'},
                {field:'TOTALPRICE',title:'金额','10%',align:'center'},
                {field:'COSTTYPE',title:'费用类型','7%',align:'center'}
            ]]
        });
    

     去掉formater后,可以在数据上做文章.

    		        		success: function(result2)
    		        		{
    		        			if(!!result2 && result2.length > 0){
    		        				$.each(result2, function(i,n){
    		        					n['orderNum'] = i+1;
    		        				});
    		        				$('#id_dailylist_dg').datagrid("loadData", result2);
    		        			}
    		        			//$('#id_dailylist_dg').datagrid("loadData", result2);
    		        			$('#id_dailylist_dg').datagrid("appendRow",{orderNum: '汇总:',YZ_CONTENT: '1112222次'});
    		        			$('#id_dailylist_dg').datagrid("appendRow",{orderNum: '汇总',YZ_CONTENT: ''});
    		        			
    

  • 相关阅读:
    Stm32高级定时器(一)
    AES算法简介
    vsim仿真VHDL输出fsdb格式文件
    ncsim仿真VHDL
    云贵高原骑行
    触发器(笔记)
    几种常见的十进制代码(笔记)
    时序电路分类
    组合逻辑电路和时序逻辑电路比较
    数字电路基础(网络整理)
  • 原文地址:https://www.cnblogs.com/juedui0769/p/4899290.html
Copyright © 2011-2022 走看看