From 9ebca917750c5a78b63cd4af0c1b35c78d34c8b2 Mon Sep 17 00:00:00 2001 From: James Thomas Date: Sun, 21 Aug 2016 23:05:53 +0100 Subject: [PATCH] Fixes removeItem not passing row data to callback. (#965) Call to .data('data') was happening after the remove() call, which deletes the retained data. This was passing undefined back to the callback for removeItem. I've changed the data retrieval to a temporary variable before the delete call. --- editor/js/ui/editableList.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/js/ui/editableList.js b/editor/js/ui/editableList.js index 921721610..72909da79 100644 --- a/editor/js/ui/editableList.js +++ b/editor/js/ui/editableList.js @@ -164,11 +164,12 @@ $('',{class:"fa fa-remove"}).appendTo(deleteButton); li.addClass("red-ui-editableList-item-removable"); deleteButton.click(function() { + var data = row.data('data'); li.addClass("red-ui-editableList-item-deleting") li.fadeOut(300, function() { $(this).remove(); if (that.options.removeItem) { - that.options.removeItem(row.data('data')); + that.options.removeItem(data); } }); });