Skip to content

Commit

Permalink
feat: add warning if necessary rows aren't added
Browse files Browse the repository at this point in the history
  • Loading branch information
zewa666 committed Sep 6, 2024
1 parent a170560 commit 6471248
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/common/src/extensions/slickCellExternalCopyManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,15 @@ export class SlickCellExternalCopyManager {

// ignore new rows if we don't have a "newRowCreator"
if ((availableRows < destH) && typeof this._addonOptions.newRowCreator === 'function') {
this._addonOptions.newRowCreator(destH - availableRows);
const rowsToAdd = destH - availableRows;
const rowsBeforePaste = this._dataWrapper.getDataLength();
this._addonOptions.newRowCreator(rowsToAdd);
const rowsAfterPaste = this._dataWrapper.getDataLength();

if (rowsAfterPaste !== rowsBeforePaste + rowsToAdd) {
console.warn(`[Slickgrid-Universal] The "newRowCreator" did not add the correct amount of rows, it should add "${rowsToAdd}" rows but it added "${rowsAfterPaste - rowsBeforePaste}" rows`);
}

this._grid.render();
}

Expand Down

0 comments on commit 6471248

Please sign in to comment.