jsp相同td值合并单元格的问题
如图,第一列已经根据2年前一位大神的回答实现了,后面第3/4/5列要跟着第一列来合并,不同中介机构的合并要分开,求大神帮忙解答,急~
老铁,挺简单的:
<!DOCTYPE html>
Insert title here
th,td{border: 1px solid #ddd;}
中介机构 | 服务范围 | 信用等级 | 不良记录 | 备注 |
---|---|---|---|---|
阿里巴巴集团 | 重大固定资产投资 | ***** | ||
洛可可 | 重大固定资产投资 | ***** | ||
重大固定资产投资 | ||||
重大固定资产投资 | ||||
重大固定资产投资 |
第一列实现的js如下,
//合并单元格
$(function(){
$('.hebing').each(function(index, element) {
debugger
if(!$(this).hasClass('hide')){
var next=$(this).parent('tr').next('tr').children('.hebing');//下一个合并的对象
//信用等级列
$(this).attr('rowspan',1);
while($(this).text()==next.text())
{
//合并
$(this).attr('rowspan',parseInt($(this).attr('rowspan'))+1);
//文字居中 添加等值的height和line-height
$(this).attr('style',"height:"+((parseInt($(this).attr('rowspan'))+1)*30)+"px;");
$(this).attr('style',"line-height:"+((parseInt($(this).attr('rowspan'))+1)*30)+"px;");
next.hide();
next.addClass('hide');
next=next.parent('tr').next('tr').children('.hebing');//下一个合并的对象
}
}
});
对应td的class:
<tr>
<td class="hebing" style="text-align: center;">
${honor.honorOrgName }
</td>
.....
....
</tr>
参照之前的写法不就实现了?
1.这个是easyui的;主要是onLoadSuccess;如果此框架不适合,你可以自己更改之前的js中的代码;
2.希望楼主能把你的这种方法合并方式用到的js发给我好吗?我qq:2654715173
不好意思之前的图片上传错了
有没有大神帮个忙啊?
<!DOCTYPE html>
Insert title here
th,td{border: 1px solid #ddd;}
中介机构 | 服务范围 | 信用等级 | 不良记录 | 备注 |
---|---|---|---|---|
阿里巴巴集团 | 重大固定资产投资 | ***** | ||
洛可可 | 重大固定资产投资 | ***** | ||
重大固定资产投资 | ||||
重大固定资产投资 | ||||
重大固定资产投资 |
照着我这写就行了
或者这样,一样的写法