From 5b6c554a01605717aa261f5bc983d6fd055f28b5 Mon Sep 17 00:00:00 2001 From: ckosmowski Date: Thu, 20 Nov 2014 10:45:52 +0100 Subject: [PATCH] Fixed #128 - If the index is < 0 and the result id equals the object id the item has been removed before and the result must therefor be null to enable the grid to add new items with the same id after they have been reset. See #128 --- src/doby-grid.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/doby-grid.js b/src/doby-grid.js index 0c5ac99..7e9ec3a 100644 --- a/src/doby-grid.js +++ b/src/doby-grid.js @@ -2658,7 +2658,12 @@ } var result = cache.modelsById[id]; - return result ? [this.items.indexOf(result), result] : null; + var idx = this.items.indexOf(result); + if (result && result.id === obj.id && idx < 0) { + result = null; + delete cache.modelsById[id]; + } + return result ? [idx, result] : null; };