Array: When there's only one row, the minus sign clears values in the fields instead of doing nothing

This commit is contained in:
Flavio Copes
2015-09-18 14:19:22 +02:00
parent 1c7928a114
commit 374f6c17e7

View File

@@ -97,11 +97,13 @@
}; };
ArrayField.prototype.remove = function(event) { ArrayField.prototype.remove = function(event) {
if ($(event.target).closest('[data-grav-array-type="row"]').siblings().length == 0) { var row = $(event.target).closest('[data-grav-array-type="row"]');
//disable for the last item if (row.siblings().length == 0) {
//on the last item we just clear its values
row.find('input').val('');
return; return;
} }
$(event.target).closest('[data-grav-array-type="row"]').remove(); row.remove();
if (this.isValueOnly()) { if (this.isValueOnly()) {
this.refreshAll(); this.refreshAll();
} }