读书人

报表中同一列的相同元素合并单元格

发布时间: 2012-10-14 14:55:07 作者: rapoo

表格中同一列的相同元素合并单元格
列的css class为class_name

   var that;$(".class_name").each(function(){if ($(this).text() == $(that).text()) {rowspan = $(that).attr("rowSpan");if (rowspan == undefined) {$(that).attr("rowSpan", 1);   rowspan = $(that).attr("rowSpan");   }rowspan = Number(rowspan) + 1;$(that).attr("rowSpan", rowspan); // do your action for the colspan cell here$(this).remove(); // .remove(); // do your action for the old cell here    } else {that = this;    }});

读书人网 >Web前端

热点推荐