Abin
Abin

Reputation: 21

Restrict duplicate item in Rubaxa ng-sortable list

I have two set of lists, list A and list B. I want to restrict duplicate items from list A to be dropped into list B. List A is configured to clone its items. I am using AngularJS with sortable (https://github.com/RubaXa/Sortable).

Here are my two configs:

$scope._listAConfig = {
    group: { name: 'listA', pull: 'clone', put: false }
};

$scope._listBConfig = {
    group: { name: 'listB', pull: false, put: ['listA'] }
};

Upvotes: 2

Views: 668

Answers (1)

2PR
2PR

Reputation: 3

in sortable github issues - issue 205 - they provide an example: jsbin , look at second and third list. I guess it's what you're trying to achieve. Looking at example if I were you I would write it that way:

$scope.listA = ['foo 1', 'foo 2'];
    $scope._listAConfig = { 
            group: {
              name: 'listA',
              pull: 'clone'
            }
    };      

    $scope.listB = ['bar 1', 'bar 2'];
    $scope._listBConfig = { 
             group: {
               name: 'listB',
               put: ['listA']
             }
    };

Upvotes: 0

Related Questions