handle removal of last row and removal of hidden input for empty array

This commit is contained in:
Stephen Birarda 2014-10-09 14:34:05 -07:00
parent e1b64275c9
commit 98925e4adb

View file

@ -425,6 +425,9 @@ function addTableRow(add_glyphicon) {
if (isArray) {
updateDataChangedForSiblingRows(row, true)
// the addition of any table row should remove the empty-array-row
row.siblings('.empty-array-row').remove()
}
badgeSidebarForDifferences($(table))
@ -451,6 +454,9 @@ function deleteTableRow(delete_glyphicon) {
// this is the last row, we can't remove it completely since we need to post an empty array
row.empty()
row.removeClass('new-row row-data')
row.addClass('empty-array-row')
row.html("<input type='hidden' class='form-control' name='" + table.attr("name").replace('[]', '')
+ "' data-changed='true' value=''>");
}