DubFriend / jquery.repeater

Create a repeatable group of input elements
MIT License
388 stars 191 forks source link

Sortable not working #144

Open bilalmalkoc opened 3 years ago

bilalmalkoc commented 3 years ago

Repater doesn't work with Jquery sortable event: https://api.jqueryui.com/sortable/#event-change

$( document ).ready(function() {
  const sortable = $('.sortable').sortable();
  const form = $('.repeater');

  $('.repeater').repeater({
      show: function () {
          $(this).slideDown();
      },
      hide: function (deleteElement) {
          if(confirm('Are you sure you want to delete this element?')) {
              $(this).slideUp(deleteElement);
          }
      },
      ready: function (setIndexes) {
          sortable.on('sortchange', setIndexes);
          console.log(form.serialize());
      },
  });
});

https://stackblitz.com/edit/js-pbdssq?file=index.js