How to realize dynamic merging and parallelism of table tables with jquery? Ask for advice

when the id is the same, the rows with the same content are merged

:

<table id="tb" border="1">
            <thead>
                <tr>
                    <td align="center"></td>
                    <td>id</td>
                    <td></td> 
                    <td></td> 
                    <td></td>
                </tr>
            </thead>
                <tr>
                    <td align="center">1</td>
                    <td>001</td>
                    <td></td> 
                    <td></td> 
                    <td></td>
                </tr>
                
                <tr>
                    <td align="center">2</td>
                    <td>001</td>
                    <td></td> 
                    <td></td> 
                    <td></td>
                </tr> 
                <tr>
                    <td align="center">3</td>
                    <td>004</td>
                    <td></td> 
                    <td></td> 
                    <td></td>
                </tr> 
                <tr>
                    <td align="center">4</td>
                    <td>003</td>
                    <td></td> 
                    <td></td> 
                    <td></td>
                </tr> 
                <tr>
                    <td align="center">5</td>
                    <td>003</td>
                    <td></td> 
                    <td></td> 
                    <td></td>
                </tr> 
                <tr>
                    <td align="center">6</td>
                    <td>005</td>
                    <td></td> 
                    <td></td> 
                    <td></td>
                </tr>
        </table>
Mar.29,2021


function initTable() {
    $('tr').each(function() {
        var child = $(this).children('td');
        var id = $(child[1]).text();

        $(child).each(function() {
            $(this).attr('data-field', id + $(this).text());
        });
    });
}

function formatCol($col) {
    var rows = {};
    $col.each(function(index) {
        if (!rows[$(this).attr('data-field')]) {
            rows[$(this).attr('data-field')] = [];
        }
        rows[$(this).attr('data-field')].push($(this));
    });
    for (var id in rows) {
        if (rows[id].length == 1) continue;
        var colCount = rows[id].length;
        var $td = rows[id];
        for (var i = 0; i < colCount; iPP) {
            if (i === 0) {
                $td[i].attr('rowspan', colCount);
            } else {
                $td[i].hide();
            }
        }
    }
}

function processTable() {
    initTable();
    var colsLength = $('thead tr:nth-child(1) td').length;
    for (var i = 1; i <= colsLength; iPP) {
        var $col = $('tr td:nth-child(' + i + ')');
        formatCol($col);
    }
}

processTable();  //
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4d65a-44f21.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4d65a-44f21.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?