foreach遍历,连续的值的单元格合并

    <tbody>
    <c:forEach var="item" items="${merchantTable}">
    <tr>
        <td width="15%" align="right" class="hebing" ><input type="checkbox" name="chnl_mer_code" value="${item.chnl_mer_code}"  checknull="" /></td>
        <td width='15%' align='right' class="hebing" >${item.chnl_mer_code}</td>
        <td width='15%' align='right' >${item.pay_type}</td>
        <td width='15%' align='right' >${item.service_code}</td>
        <td width='15%' align='right' >${item.chnl_name}</td>
        <td width='15%' align='right' >${item.chnl_code}</td>
        <td width='15%' align='right' >${item.status}</td>
    </tr>
    </c:forEach>
    </tbody>



    $(function(){
        $('.hebing').each(function(index, element) {
            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);
                    next.hide();
                    next.addClass('hide');
                    next=next.parent('tr').next('tr').children('.hebing');//下一个合并的对象
                }
            }
        });

    });










 

转载于:https://my.oschina.net/Skynet01/blog/2979877

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值