0

Stuck in a problem where I have list of lists and i want to re-order the lists of list through drag and drop my model is

  {
  "selected": null,
  "lists": {
    "A": [
      {
        "data": "code"
      },
      {
        "data": "code enable"
      },
      {
        "data": "code disable"
      }
    ],
    "B": [
      {
        "data": "code"
      },
      {
        "data": "code enable"
      },
      {
        "data": "code disable"
      }
    ],
    "C": [
     {
        "data": "code"
      },
      {
        "data": "code decode"
      },
      {
        "data": "code decode"
      }
    ]
  }
}

Now I want to re-order this model in such a way that if i drag the lists C to lists A it should replace the div new model will be

   {
  "selected": null,
  "lists": {
    "C": [
      {
        "data": "code"
      },
      {
        "data": "code decode"
      },
      {
        "data": "code decode"
      }
    ],
    "B": [
      {
        "data": "code"
      },
      {
        "data": "code enable"
      },
      {
        "data": "code disable"
      }
    ],
    "A": [
      {
        "data": "code"
      },
      {
        "data": "code enable"
      },
      {
        "data": "code disable"
      }
    ],
  }
}

app.html

          <div ng-repeat="list in models.lists" class="col-md-6">
            <div class="panel panel-info" ng-repeat="data in lists">
                <div class="panel-heading">
                    <h3 class="panel-title">List {{data.data}}</h3>
                </div>
            </div>
        </div>

app.js

 $scope.models = {
    selected: null,
    lists: {"A": [], "B": [],"C":[]
};

// Generate initial model
Kumail Hussain
  • 869
  • 2
  • 26
  • 49
  • This isn't an answer, exactly, but for my drag and drop requirements I use https://github.com/swimlane/ngx-dnd It's MIT licensed open source, so there's really no restriction on use. Much greater flexibility and much easier than rolling your own. – Stephen R. Smith Jul 05 '17 at 18:14
  • 1
    looks good thanks for your suggestion – Kumail Hussain Jul 05 '17 at 18:38

0 Answers0