1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 表格内容相同单元格合并

表格内容相同单元格合并

时间:2021-03-06 08:44:54

相关推荐

表格内容相同单元格合并

//表格内容相同单元格合并 colIdx列索引jQuery.fn.rowspan = function(colIdx) { //封装的一个JQuery小插件return this.each(function(){var that;var rowspan;$('tr', this).each(function(row) {$('td:eq('+colIdx+')', this).filter(':visible').each(function(col) {if (that!=null && $(this).html() == $(that).html()) {/*上一行*/var prev_name=$(this).parent().prev().find('td:last').text()/*var prev_name_arr=prev_name.split('-');*//*当前行*/var pro_name=$(this).parent().find('td:last').text()/* var pro_name_arr=pro_name.split('-')*/rowspan = $(that).attr("rowSpan");if (rowspan == undefined) { /*如果是列第一个*/$(that).attr("rowSpan",1);rowspan = $(that).attr("rowSpan");}if(prev_name!=pro_name){ /*如果当前行的值与上一行的值不相等*/that = this;/*就把当前行记录进行比较*/}else{rowspan = Number(rowspan)+1;$(that).attr("rowSpan",rowspan);$(this).hide();}} else {that = this;}});});});}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。