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) {
if ($(event.target).closest('[data-grav-array-type="row"]').siblings().length == 0) {
//disable for the last item
var row = $(event.target).closest('[data-grav-array-type="row"]');
if (row.siblings().length == 0) {
//on the last item we just clear its values
row.find('input').val('');
return;
}
$(event.target).closest('[data-grav-array-type="row"]').remove();
row.remove();
if (this.isValueOnly()) {
this.refreshAll();
}