Fix #304, saving array fields

This commit is contained in:
Flavio Copes
2015-11-27 19:28:19 +01:00
parent b7e3978af0
commit 4f29263377
2 changed files with 14 additions and 2 deletions

View File

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