Part: Javascripte nicht ins HTML schreiben sondern nach reinit_widgets
authorSven Schöling <s.schoeling@linet-services.de>
Mon, 8 Jan 2018 15:26:15 +0000 (16:26 +0100)
committerSven Schöling <s.schoeling@linet-services.de>
Mon, 8 Jan 2018 17:02:26 +0000 (18:02 +0100)
js/kivi.Part.js
templates/webpages/part/_customerprices.html
templates/webpages/part/_makemodel.html

index bf35cb8..7680551 100644 (file)
@@ -744,6 +744,14 @@ namespace('kivi.Part', function(ns) {
       if (!$(elt).data('part_picker'))
         $(elt).data('part_picker', new kivi.Part.Picker($(elt)));
     });
+
+    kivi.run_once_for('#customerprice_rows', 'customerprice_row_sort_renumber', function(elt) {
+      $(elt).on('sortstop', kivi.Part.customerprice_renumber_positions);
+    });
+
+    kivi.run_once_for('#makemodel_rows', 'makemodel_row_sort_renumber', function(elt) {
+      $(elt).on('sortstop', kivi.Part.makemodel_renumber_positions);
+    });
   }
 
   ns.init = function() {
index 9384a6c..49f32c3 100644 (file)
     </td>
   </tr>
   [% L.sortable_element('#customerprice_rows') %]
-
-  <script type="text/javascript">
-  $(function() {
-
-    $('#customerprice_rows').on('sortstop', function(event, ui) {
-      kivi.Part.customerprice_renumber_positions();
-    });
-
-  })
-  </script>
index 71fce5a..e56a886 100644 (file)
     </td>
   </tr>
   [% L.sortable_element('#makemodel_rows') %]
-
-  <script type="text/javascript">
-  $(function() {
-
-    $('#makemodel_rows').on('sortstop', function(event, ui) {
-      kivi.Part.makemodel_renumber_positions();
-    });
-
-  })
-  </script>