radiocampus/assets/AFormSet: enable definition of the removeItem method

This commit is contained in:
Chris Tactic 2024-11-18 08:33:34 +01:00
parent f073a9ef77
commit 4f28e884ae

View File

@ -108,6 +108,7 @@
//! If provided call this function instead of adding an item to rows on "+" button click. //! If provided call this function instead of adding an item to rows on "+" button click.
actionAdd: Function, actionAdd: Function,
actionRemove: Function,
//! If True, columns can be reordered //! If True, columns can be reordered
columnsOrderable: Boolean, columnsOrderable: Boolean,
@ -161,14 +162,12 @@
this.$emit('move', {...event, seŧ: set_}) this.$emit('move', {...event, seŧ: set_})
}, },
removeItem(row) { removeItem(row, item) {
const item = this.items[row] if(this.actionRemove) {
if(item.id) { this.actionRemove(row, item);
// TODO return
} }
else {
this.items.splice(row,1) this.items.splice(row,1)
}
}, },
//! Load items into set //! Load items into set