From 4f28e884ae69bed8a71bcaf70a5911b3c7aa7857 Mon Sep 17 00:00:00 2001 From: Christophe Siraut Date: Mon, 18 Nov 2024 08:33:34 +0100 Subject: [PATCH] radiocampus/assets/AFormSet: enable definition of the removeItem method --- radiocampus/assets/src/components/AFormSet.vue | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/radiocampus/assets/src/components/AFormSet.vue b/radiocampus/assets/src/components/AFormSet.vue index 7121550..89ce78e 100644 --- a/radiocampus/assets/src/components/AFormSet.vue +++ b/radiocampus/assets/src/components/AFormSet.vue @@ -108,6 +108,7 @@ //! If provided call this function instead of adding an item to rows on "+" button click. actionAdd: Function, + actionRemove: Function, //! If True, columns can be reordered columnsOrderable: Boolean, @@ -161,14 +162,12 @@ this.$emit('move', {...event, seĊ§: set_}) }, - removeItem(row) { - const item = this.items[row] - if(item.id) { - // TODO - } - else { - this.items.splice(row,1) + removeItem(row, item) { + if(this.actionRemove) { + this.actionRemove(row, item); + return } + this.items.splice(row,1) }, //! Load items into set