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.
This commit is contained in:
James Thomas 2016-08-21 23:05:53 +01:00 committed by Nick O'Leary
parent 456fc23463
commit 9ebca91775
1 changed files with 2 additions and 1 deletions

View File

@ -164,11 +164,12 @@
$('<i/>',{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);
}
});
});