簡體   English   中英

AngularJS拖放

[英]AngularJS Drag and Drop

如果我有如下的JSON ..

$scope.pools = [    {id: 1, poolName : 'Pool1', env : 'Env1', executionMode: 'Both',
        modelets: [{id: 'm1', name : 'MM1', status : 'active', capacity : '1 GB'},
                   {id: 'm2', name : 'MM2', status : 'active', capacity : '1 GB'},
                   {id: 'm3', name : 'MM3', status : 'active', capacity : '1 GB'}]},
    {id: 2, poolName : 'Pool2', env : 'Env2', executionMode: 'Both',
        modelets: [{id: 'm4', name : 'MR1', status : 'active', capacity : '1 GB'},
                   {id: 'm5', name : 'MR2', status : 'active', capacity : '1 GB'}]
    }
];

我必須將模型集從一個池拖放到另一個池。 例如,如果我將m3從pool1拖放到pool2的模型集中,則應將m3從pool1.modelets中刪除,並將其添加到pool2.modelets中,反之亦然。

注意:我正在嘗試使用http://codef0rmer.github.io/angular-dragdrop/#/

請提供有效的解決方案。 感謝adnavce。

最終,我得到了在這種情況下可以正常工作的某些東西...我們需要在可拖動元素中進行以下更改。

<div class="btn btn-primary" data-drag="true" data-jqyoui-options="{revert: 'invalid'}" ng-model="pool.modelets" jqyoui-draggable="{index: {{$index}},animate:true}" ng-hide="!modelet.name">{{modelet.name}}</div>

更新的提琴手工作正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM