Skip to content

Commit

Permalink
_StoreMixin: clamp rows.max to a minimum of 0
Browse files Browse the repository at this point in the history
If the rows of a grid are removed from bottom to top then each row removal
will decrement rows.max, including the final row removal which will set
rows.max to -1. This breaks the logic in _StoreMixin's 'add, update' event
handler preventing insertion of new rows when items are added to the store.

Fixes #1305
  • Loading branch information
msssk committed Jun 22, 2020
1 parent 60751e2 commit 1b43b94
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions _StoreMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,12 @@ define([
rows.max--;
}

// max should never be less than zero; if it is the logic in the 'add, update' handler
// below will prevent insertion of rows (https://github.com/SitePen/dgrid/issues/1305)
if (rows.max < 0) {
rows.max = 0;
}

row = rows[from];

// check to make the sure the node is still there before we try to remove it
Expand Down

0 comments on commit 1b43b94

Please sign in to comment.