Skip to content

Commit 83242ee

Browse files
author
Stanislav Idolov
authored
ENGCOM-1386: #7369: [GitHub] Colour swatches are being deleted and re-arrangeed af… #1230
2 parents 82099bc + 3deca50 commit 83242ee

File tree

1 file changed

+13
-5
lines changed
  • app/code/Magento/Swatches/view/adminhtml/web/js

1 file changed

+13
-5
lines changed

app/code/Magento/Swatches/view/adminhtml/web/js/visual.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ define([
143143
element.hide();
144144
this.totalItems--;
145145
this.updateItemsCountField();
146+
this.updateSortOrder();
146147
}
147148
},
148149

@@ -153,6 +154,17 @@ define([
153154
$('swatch-visual-option-count-check').value = this.totalItems > 0 ? '1' : '';
154155
},
155156

157+
/**
158+
* Update sort order values
159+
*/
160+
updateSortOrder: function () {
161+
jQuery('[data-role=swatch-visual-options-container] tr:not(.no-display) [data-role=order]').each(
162+
function (index, element) {
163+
jQuery(element).val(index + 1);
164+
}
165+
);
166+
},
167+
156168
/**
157169
* Enable delete button for new option
158170
*
@@ -267,11 +279,7 @@ define([
267279
* Update component
268280
*/
269281
update: function () {
270-
$('[data-role=swatch-visual-options-container] [data-role=order]').each(
271-
function (index, element) {
272-
$(element).val(index + 1);
273-
}
274-
);
282+
swatchVisualOption.updateSortOrder();
275283
}
276284
});
277285
});

0 commit comments

Comments
 (0)