Frage

I'm trying to get AngularUI to clone items from one list to the other. Its not working.

I think I have the options correct, but not sure. I'm sure it's something silly.. These are my options:

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

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

As always any help is appreciated.

War es hilfreich?

Lösung

Check out this CodePen example: http://cdpn.io/akCIe

I think it does what you are looking for. The sortableOptions include 'stop' & 'update' functions instead of using helper:"clone" which doesn't seem to work.

  $scope.sortableOptions = {
    connectWith: ".apps-container",
    update: function (e, ui) {
      if (ui.item.sortable.droptarget.hasClass('first')) {
        ui.item.sortable.cancel();
      }
    },
    stop: function (e, ui) {
      if ($(e.target).hasClass('first') &&
          e.target != ui.item.sortable.droptarget[0]) {
        $scope.sourceScreens = originalScreens.slice();
      }
    }
  };
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top