olifolkerd / tabulator

Interactive Tables and Data Grids for JavaScript
http://tabulator.info
MIT License
6.6k stars 811 forks source link

Moveable rows, with virtual dom and non-frozen handles cause js error. #3386

Closed leleftheriades closed 2 years ago

leleftheriades commented 3 years ago

Try to drag a row from the handle. https://codepen.io/elefteris/pen/JjJWQEJ

If you create a table with the following configuration:

  1. virtualDom: true
  2. movableRows: true
  3. Handle row that is not frozen { rowHandle: true, formatter: "handle", frozen: false, headerSort: false, width: 30, minWidth: 30 }
  4. Populate the table with enough lines such that not all rows are visible (and over vDomWindowMinTotalRows =20)

Dragging the row gives the following javascript error:

File: /src/js/modules/moveable_rows.js Error: row.modules.moveRow is undefined

  MoveRows.prototype._bindMouseMove = function () {
      var self = this;
        self.table.rowManager.getDisplayRows().forEach(function (row) {
        if ((row.type === "row" || row.type === "group") && row.modules.moveRow.mousemove) {
            row.getElement().addEventListener("mousemove", row.modules.moveRow.mousemove);
        }
    });
};

I tried this in tabulator version 4.9.3

Investigating the code, we see that row.modules.moveRow is populated: -for rendered rows in renderTable -> _virtualRenderFill -> self.styleRow(row, index) -for frozen columns (if active) in renderTable -> frozenColumns.layout -> self.layoutRow(row)

olifolkerd commented 2 years ago

Hey @leleftheriades

This is no longer an issue in the 5.0 branch that will be released later today.

Cheers

Oli :)