Uploaded image for project: 'Keikai'
  1. Keikai
  2. KEIKAI-624

scrolling down causes a js error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 5.10.0
    • Fix Version/s: 5.11.0
    • Component/s: None
    • Security Level: Jimmy
    • Labels:
      None

      Description

      Steps to Reproduce

      1. load the zul with the file
      2. scroll down the sheet with a steady speed.
      see keikai-624.mp4

      Current Result

      zss.wpd:18352 Uncaught TypeError: Cannot read properties of undefined (reading 'appendZSH')
      at init.appendZSH (zss.wpd:18352:61)
      at init._appendZSH (zss.wpd:40514:20)
      at init._setRowHeight (zss.wpd:40567:10)
      at init._setRowHeight (zssex.wpd:4247:33)
      at init.updateRowAutoHeight (zssex.wpd:4832:15)
      at init.fireProcessAutoHeight_ (zssex.wpd:4880:33)
      at init.create_ (zss.wpd:18327:10)
      at init.$supers (zk.wpd:11639:21)
      at init.create_ (zss.wpd:25206:9)
      at init._createCellsIfCached (zss.wpd:25241:10)

      Expected Result

      no error

      Debug Information

      • the js error is caused by:
        the last row in this.rows (CellBlockCtrl.rows) doesn't match the row index, this.rows[143].r is 145, it should be 143.
        this.rows[this.rows.length-1].r != row.r-1
        I found that's because this.rows doesn't contain serial rows, there are 2 rows missing in the middle, e.g.
        rows[300].r=300
        rows[301].r=303
      • when scrolling down, keikai will append each row's widget and DOM:
        appendRow (zss.wpd:18620)
        create_ (zss.wpd:18299)
        $supers (zk.wpd:11639)
        create_ (zss.wpd:25206)
        _createCellsIfCached (zss.wpd:25241)
        doScroll (zss.wpd:25344)
        _doScroll (zss.wpd:35965)
        _doVScroll (zss.wpd:35959)
        (anonymous) (zss.wpd:35946)
        

      After appending rows, it will set auto row height

      _setRowHeight (zss.wpd:40761)
      _setRowHeight (zssex.wpd:4247)
      updateRowAutoHeight (zssex.wpd:4832)
      fireProcessAutoHeight_ (zssex.wpd:4880)
      create_ (zss.wpd:18327)
      $supers (zk.wpd:11639)
      create_ (zss.wpd:25206)
      _createCellsIfCached (zss.wpd:25241)
      doScroll (zss.wpd:25344)
      _doScroll (zss.wpd:35965)
      _doVScroll (zss.wpd:35959)
      

      MainBlockCtrl

      	_createCellsIfCached: function (dir, size, jump, vr0) {
      		var sheet = this.sheet,
      			wgt = sheet._wgt,
      			cr = this.range,
      			...
      		switch (dir) {
      		case 'south':
      			var tRow = Math.max(cr.bottom + 1, sheet.tp.block ? sheet.tp.block.range.bottom + 1 : 0),
      

      When the error happens, cr.bottom is 1 more than actually rendered row index. .e.g. cr.bottom is 300, but currently keikai only renders to the row index 299. So tRow will be 301. Then 301-299 = 2, so there are 2 rows not appended.

      the range.bottom is changed by

      _setRowHeight: function(row, height, fireevent, loadvis, hidden, metaid, isCustom) {
      ...
      		let visitBottom = zss.SSheetCtrl._getVisibleRange(this).bottom;
      		if (this.getSheetData().rect.bottom >= visitBottom) {
      			...
      			this.activeBlock.range.bottom = visitBottom;
      			this.activeBlock.range.reCalcSize();
      		}
      

      this.activeBlock.range.bottom = visitBottom; usually set the range.bottom to a number 1 more than this.activeBlock.range.bottom but there is no row appended actually. It will cause appending row incorrectly in _createCellsIfCached().

      Workaround

      don't change this.activeBlock.range.bottom in _setRowHeight().

        Attachments

        1. keikai-624.js
          12 kB
        2. keikai-624.mp4
          1.09 MB
        3. keikai-624.xlsx
          16 kB
        4. keikai-624.zul
          0.2 kB
        5. Keikai624Controller.java
          0.7 kB

          Issue Links

            Activity

              People

              Assignee:
              gordonhsu gordonhsu
              Reporter:
              hawk hawk
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: