Skip to content

Commit bf45ad2

Browse files
author
Sergii Kovalenko
committed
MAGETWO-63321: Issue when deleting item from Product options grid containing more than 20 options
1 parent 3661bc3 commit bf45ad2

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,15 +839,16 @@ define([
839839
recordsData;
840840

841841
if (this.deleteProperty) {
842+
recordsData = this.recordData();
842843
recordInstance = _.find(this.elems(), function (elem) {
843844
return elem.index === index;
844845
});
845846
recordInstance.destroy();
846847
this.elems([]);
847848
this._updateCollection();
848849
this.removeMaxPosition();
849-
this.recordData()[recordInstance.index][this.deleteProperty] = this.deleteValue;
850-
this.recordData.valueHasMutated();
850+
recordsData[recordInstance.index][this.deleteProperty] = this.deleteValue;
851+
this.recordData(recordsData);
851852
this.reinitRecordData();
852853
this.reload();
853854
} else {

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/dynamic-rows/dynamic.rows.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,16 @@ define([
6262
var elems,
6363
recordInstanceMock = new ElementMock(1),
6464
elem2 = new ElementMock(2);
65-
66-
spyOn(recordInstanceMock, "destroy").toHaveBeenCalled();
65+
spyOn(recordInstanceMock, "destroy");
66+
model.recordData({1: {}});
6767
elems = [
6868
recordInstanceMock,
6969
elem2
7070
];
7171
model.elems(elems);
7272
model.deleteProperty = true;
7373
model.deleteRecord(1, 1);
74+
expect(model.recordData()).toEqual([]);
7475
});
7576
});
7677
});

0 commit comments

Comments
 (0)