Re: [AngularJS] Help: How to AngularUI sortable clone to work ? [SOLVED]

313 views
Skip to first unread message

Gary M

unread,
Mar 4, 2014, 10:21:23 PM3/4/14
to ang...@googlegroups.com
Update:

I case anyone is interested.. 

Thodoris Greasidis  had responded to a bug being filed on ui.sortable. He solved the clone issue by making a copy of the source item data and added it back to the originating list in the original index position on drop.  

I believe he may be adding the clone function to the next version of ui-sortable.

This is a link to his pen demonstrating the clone feature working: http://codepen.io/thgreasi/pen/DrJGe

These are the options required in the controller to create the clone functionality. When the functionality is added to the directive, this will no longer be requires

  $scope.sortableOptions = {
    connectWith: ".connected-apps-container",
    stop: function (e, ui) {
      if ($(e.target).hasClass('first') &&
          e.target != ui.item.sortable.droptarget[0]) {
        $scope.sourceScreens = originalScreens.slice();
      }
    }
  };

And earlier example shows a technique (add to the options) to preserve the order of the originating list on a drop :

    update: function (e, ui) {
      if (ui.item.sortable.droptarget.hasClass('first')) {
        ui.item.sortable.cancel();
      }
    },


cheers






On Mon, Mar 3, 2014 at 7:11 PM, Gary M <ga...@oedata.com> wrote:
Hi

Sorry if this is not the correct forum for this question, but I posted on stackoverflow and did not get the question answered.

I'm trying to use the clone in ui.sortable. I can't seem to get the clone feature to clone. I did see the clone feature was merged and it appear to be in the js. I still can't get it to work..

These are the options:
    $scope.sortableOptions = {
        connectWith: ".sort",
        helper: 'clone',
        scroll: false
    };

I haven't started debugging the directive yet, I wanted to ask to see if I'm not doing something wrong..

this is the jsfiddle: http://jsfiddle.net/Npyyg/  

Thanks

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/Pf_XSt3CEdc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages