diff --git a/cypress/integration/column.js b/cypress/integration/column.js index cbdc4d2c..e4108ac3 100644 --- a/cypress/integration/column.js +++ b/cypress/integration/column.js @@ -83,6 +83,19 @@ describe('Column', function () { }); }); + it('resizes body cells while the column is being dragged', function () { + cy.get('.dt-cell--header-4 .dt-cell__resize-handle') + .trigger('mousedown') + .trigger('mousemove', { pageX: 700, pageY: 20, which: 1 }); + + cy.getColumnCell(4).invoke('css', 'width').then((width) => { + cy.getCell(4, 1) + .should('have.css', 'width', width); + }); + + cy.get('body').trigger('mouseup'); + }); + it('resize column using double click', function () { cy.get('.dt-cell--header-4 .dt-cell__resize-handle').trigger('dblclick'); cy.getColumnCell(4).should('have.css', 'width') diff --git a/src/columnmanager.js b/src/columnmanager.js index d27d9acf..7a473cf7 100644 --- a/src/columnmanager.js +++ b/src/columnmanager.js @@ -165,12 +165,6 @@ export default class ColumnManager { document.body.classList.remove('dt-resize'); if (!$resizingCell) return; isDragging = false; - - const { - colIndex - } = $.data($resizingCell); - this.setColumnWidth(colIndex); - this.style.setBodyStyle(); $resizingCell = null; }; $.on(document.body, 'mouseup', onMouseup); @@ -198,6 +192,8 @@ export default class ColumnManager { width: finalWidth }); this.setColumnHeaderWidth(colIndex); + this.setColumnWidth(colIndex); + this.style.setBodyStyle(); }; $.on(document.body, 'mousemove', onMouseMove); this.instance.on('onDestroy', () => {