How to combine element ui tables dynamically

as shown in the figure, merge the first two columns with the same mainId, because the number of data with the same mainId is variable and need to be juxtaposed dynamically. I have been unable to think of a good way, so ask netizens. The
code is here for everyone to modify: https://jsfiddle.net/ryx47gL8/

clipboard.png

Jan.10,2022

export function rowSpan (id, row, cols, standardCol) {
  var tb = document.getElementById(id)
  var lastValue = ''
  var value = ''
  var pos = 1
  for (var i = row; i < tb.rows.length; iPP) {
    value = tb.rows[i].cells[standardCol].innerHTML
    if (value !== '' && value !== '\t' && value !== '\n' && value !== '\r') {
      if (lastValue == value) { // eslint-disable-line
        var colsbak = cols.slice(0)
        colsbak.sort(function (a, b) {
          return a - b
        })
        for (var c = colsbak.length - 1; c >= 0; c--) {
          tb.rows[i].deleteCell(colsbak[c])
          tb.rows[i - pos].cells[colsbak[c]].rowSpan = tb.rows[i - pos].cells[colsbak[c]].rowSpan + 1
        }
        posPP
      } else {
        lastValue = value
        pos = 1
      }
    }
  }
}

I operate dom.
id is the row in which the id,row: of the table is merged, usually the array, the column to be merged, the standardCol: standard column, that is, your mainId column

call as follows, call

after dom
rowSpan('fixedtb', 0, [0, 1, 2, 3, 4, 5], 5)

means that starting from the first row, listing 6 as the standard, merging the first six columns


it is better to ask for help than to beg yourself. We have to search all kinds of Google and finally find a way. Refer to the article https://blog.csdn.net/qq_2946.
to put the complete code for others to refer to https://jsfiddle.net/u06mo3sy/

.
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-1eb31f2-46ead.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-1eb31f2-46ead.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?