复杂表格删除一整列怎么实现,求算法

图片描述

点击单元格删除单元格所在列,表格不乱怎么实现?
怎么算受到影响的colspan rowspan
比如删除中止1后 33333333变成colspan=1 111111 变成colspan=2;

    代码如下:
    ``<table style="border-collapse: collapse" cellspacing="0">
        <tbody>
            <tr>
                <td colspan="3" rowspan="1" class="column" style="width:120px;height:20px">11111111111</td>
                <td colspan="4" rowspan="1" class="column" style="width:120px;height:20px">22222222</td>
            </tr>
            <tr>
                <td colspan="1" rowspan="3" itemid="0" class="column" style="width:120px;height:20px" field="单位数量1">单位数量1</td>
                <td colspan="2" rowspan="1" class="column" style="width:120px;height:20px">3333333333</td>
                <td colspan="3" rowspan="1" class="column" style="width:120px;height:20px"> 4444444444</td>
                <td colspan="1" rowspan="3" itemid="6" class="column" style="width:120px;height:20px" field="单位数量2">单位数量2</td>
            </tr>
            <tr>
                <td colspan="1" rowspan="2" itemid="1" class="column" style="width:120px;height:20px" field="中止">中止1</td>
                <td colspan="1" rowspan="2" itemid="2" class="column" style="width:120px;height:20px" field="单位数量3">单位数量3</td>
                <td colspan="1" rowspan="2" itemid="3" class="column" style="width:120px;height:20px" field="单位数量4">单位数量4</td>
                <td colspan="2" rowspan="1" class="column" style="width:120px;height:20px">555555555</td>
            </tr>
            <tr>
                <td colspan="1" rowspan="1" itemid="4" class="column" style="width:120px;height:20px" field="单位数量5">单位数量5</td>
                <td colspan="1" rowspan="1" itemid="5" class="column" style="width:120px;height:20px" field="单位数量6">单位数量6</td>
            </tr>
        </tbody>
    </table>
阅读 1.4k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题