jspreadsheet / ce

Jspreadsheet is a lightweight vanilla javascript plugin to create amazing web-based interactive tables and spreadsheets compatible with other spreadsheet software.
https://bossanova.uk/jspreadsheet/v4
MIT License
6.72k stars 824 forks source link

setRowDate is not work #1596

Closed bibibala closed 1 year ago

bibibala commented 1 year ago
          (vue 2.6.3) (jspreadsheet-ce 4.10.2)

My logic here is that when I enter two values and then judge the type, and then reassign the data of this row, but my table is not updated by using setRowData, but when I print getData after the assignment, I find that the data has changed , but the dom is not refreshed, how to solve this change, looking forward to your reply

` // info ['长链/短链接','Number','Number' ,'Number']

  // get currentRow data
  let info = this.$refs.excel.excel.getRowData(this.current.row - 1)
  if (validate.number(info[1]) === true && validate.number(info[2]) === true) {
    if ((info[2] - info[1]) > 0) {
      info[0] = `长链`
      info[3] = Math.abs(info[2] - info[1])
      console.log(info)
      this.$refs.excel.excel.setRowData(this.current.row, info)
    } else if ((info[2] - info[1]) === 0) {
      this.$msg.warning(`长链和断链数值不能相同`)
    } else {
      info[0] = `短链`
      info[3] = Math.abs(info[2] - info[1])
      console.log(info)
      this.$refs.excel.excel.setRowData(this.current.row, info)
    }
  } else {
    this.$msg.warning(`输入的数据不符合格式`)
  }
`

Originally posted by @ZSQNightwish in https://github.com/jspreadsheet/ce/issues/380#issuecomment-1429154409