jqGrid 合并值相同的多行 jeesite function setRowSpan () { var obj = $("#dataGrid"); var rowIds = obj.getDataIDs(); var count = 0;//要合并的单元格数 var index = 0; //起始行数 var rowData = obj.jqGrid('getRowData',rowIds[0]).proName; if(rowIds.length > 1){ $("tr[id^=subTotal]").css("background", "#E0E0E0"); $("#total").css("background", "#1e90ff"); for(var col = 1; col < rowIds.length; col ++){ //获取成品名称 var data = obj.jqGrid('getRowData',rowIds[col]).proName; if(rowData == data){ //隐藏当前单元格hideCol $("#dataGrid tr:gt("+col+"):eq(0) td:eq(1)").hide(); count ++; index ++; }else if(rowData != data){ rowData = data; if(count > 0){ //上面的行跨行 $("#dataGrid tr:gt("+(col-count-1)+"):eq(0) td:eq(1)").attr("rowspan",count+1); //隐藏重复单元格 //$("#dataGrid tr:gt("+(col-1)+"):eq(0) td:eq(1)").hide(); count = 0; } } } } }