From: Vincent Vanwaelscappel Date: Wed, 1 Jun 2022 17:02:46 +0000 (+0200) Subject: wait #5285 @0:20 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=dbe2861846fbc17d83bc79ee10990976a89d8c9f;p=cubist_cms-back.git wait #5285 @0:20 --- diff --git a/src/public/bunchmultiple/bunchmultiple.js b/src/public/bunchmultiple/bunchmultiple.js index ee83680..5a256d8 100644 --- a/src/public/bunchmultiple/bunchmultiple.js +++ b/src/public/bunchmultiple/bunchmultiple.js @@ -19,8 +19,10 @@ var initValues = this.element.data('values'); - if (initValues.length === 0 && this.element.hasClass('showEmpty')) { - this.initItem(); + if (initValues.length === 0) { + if (this.element.hasClass('showEmpty')) { + this.initItem(); + } } else { $.each(initValues, function (k, v) { $this.initItem(v, true); @@ -115,7 +117,7 @@ var val = []; var $this = this; var id = this.element.attr('id'); - var selector = '.item' + this.bmidselector + ':not(.sample) ' + this.bmidselector + ' .bunchfields'; + var selector = '.item' + this.bmidselector + ':not(.sample) ' + this.bmidselector + '>.bunchfields'; var list = this.element.find(selector); $.each(list, function () { @@ -188,8 +190,9 @@ removeItem: function (item) { $(item).remove(); - if(this.element.hasClass('showEmpty') && this.element.find('.item' + this.bmidselector + ':not(.sample)').length === 0) { - this.initItem(); + if (this.element.hasClass('showEmpty') && this.element.find('.item' + this.bmidselector + ':not(.sample)').length === 0) { + console.log('init item after remove'); + this.initItem(); } var $this = this; @@ -208,6 +211,7 @@ }, initItem: function (values) { + console.log(values); var $this = this; var collapsed = true; var isNew = false;