]> _ Git - cubist_cms-back.git/commitdiff
wait #4404 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 10 May 2021 16:43:18 +0000 (18:43 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 10 May 2021 16:43:18 +0000 (18:43 +0200)
src/resources/views/fields/select_and_order.blade.php

index 898d09f2e4bddab6673617ec779f2478a7d2e506..758cfc75403062ba66c50e8bed593c0020fe72b1 100644 (file)
     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) {
                         });
                     }
                 }
-            }
-        }).disableSelection();
+
+        }
     });
 </script>
 @endpush