From: Vincent Vanwaelscappel Date: Mon, 10 May 2021 16:43:18 +0000 (+0200) Subject: wait #4404 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=1220ee0d146f940c3f89a34833a7d5f94f962fa5;p=cubist_cms-back.git wait #4404 @2 --- diff --git a/src/resources/views/fields/select_and_order.blade.php b/src/resources/views/fields/select_and_order.blade.php index 898d09f..758cfc7 100644 --- a/src/resources/views/fields/select_and_order.blade.php +++ b/src/resources/views/fields/select_and_order.blade.php @@ -123,8 +123,17 @@ jQuery(document).ready(function($) { $( "#{{ $field['name'] }}_all, #{{ $field['name'] }}_selected" ).sortable({ connectWith: ".{{ $field['name'] }}_connectedSortable", - update: function() { - var updatedlist = $(this).attr('id'); + update: function(){ + updateField(this); + }, + }).disableSelection(); + + $( "#{{ $field['name'] }}_all, #{{ $field['name'] }}_selected" ).each(function(){ + updateField(this); + }); + + function updateField(e){ + var updatedlist = $(e).attr('id'); if((updatedlist == "{{ $field['name'] }}_selected")) { $("#{{ $field['name'] }}_results").html(""); if($("#{{ $field['name'] }}_selected").find('li').length==0) { @@ -143,8 +152,8 @@ }); } } - } - }).disableSelection(); + + } }); @endpush