From: Vincent Vanwaelscappel Date: Tue, 31 May 2022 11:51:30 +0000 (+0200) Subject: wip #5301 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=3c7d966a0da7abbbb3412999c1965856a4e3d912;p=cubist_cms-back.git wip #5301 @0.5 --- diff --git a/src/public/bunchmultiple/bunchmultiple.js b/src/public/bunchmultiple/bunchmultiple.js index 1d0a03d..dc8f432 100644 --- a/src/public/bunchmultiple/bunchmultiple.js +++ b/src/public/bunchmultiple/bunchmultiple.js @@ -56,10 +56,7 @@ return false; }); - this.element.on('change', 'input' + this.bmidselector + - ',select' + this.bmidselector + - ',textarea' + this.bmidselector + - ',.dropzone' + this.bmidselector, function () { + this.element.on('change', 'input' + this.bmidselector + ',select' + this.bmidselector + ',textarea' + this.bmidselector + ',.dropzone' + this.bmidselector, function () { $this.updateAndChange(); return true; }); @@ -87,6 +84,10 @@ }, 1000); this.resize(); + + setInterval(function () { + $this.serialize(); + }, 2000); }, cleanTemplate: function () { @@ -111,12 +112,13 @@ }, serialize: function () { - - var val = []; var $this = this; var id = this.element.attr('id'); - $.each(this.element.find('.item' + this.bmidselector + ':not(.sample) .bunchfields' + this.bmidselector), function () { + var selector = '.item' + this.bmidselector + ':not(.sample) ' + this.bmidselector + ' .bunchfields'; + var list = this.element.find(selector); + + $.each(list, function () { $(this).find('.bunchmultiple').each(function () { try { $(this).data('bunchmultiple').serialize(); @@ -178,9 +180,7 @@ var $this = this; new Sortable(this.element.find('.bunchmultiple__items' + this.bmidselector).get(0), { - handle: '.sort-handle', - ghostClass: 'ghost', - onSort: function (evt) { + handle: '.sort-handle', ghostClass: 'ghost', onSort: function (evt) { $this.onSort(evt); }, }); @@ -301,9 +301,7 @@ jQuery.cachedScript = function (url, options) { // Allow user to set any option except for dataType, cache, and url options = $.extend(options || {}, { - dataType: "script", - cache: true, - url: url + dataType: "script", cache: true, url: url }); // Use $.ajax() since it is more flexible than $.getScript