]> _ Git - cubist_cms-back.git/commitdiff
wait #5285 @0:20
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 1 Jun 2022 17:02:46 +0000 (19:02 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 1 Jun 2022 17:02:46 +0000 (19:02 +0200)
src/public/bunchmultiple/bunchmultiple.js

index ee836808f2a0fedf215cd20cfcc7ca2a568c81e4..5a256d89616fd2ab175a9ee589a08a13822f6296 100644 (file)
 
             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);
             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 () {
 
         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;
         },
 
         initItem: function (values) {
+            console.log(values);
             var $this = this;
             var collapsed = true;
             var isNew = false;