akserg / ng2-dnd

Angular 2 Drag-and-Drop without dependencies
MIT License
839 stars 252 forks source link

Nested Sort-ables #58

Open LeahPike opened 8 years ago

LeahPike commented 8 years ago

I'm after some help, is it possible to have a nested sort-able drag and drop?

I have one list of groups, which is sort-able, each group contains a list of fields which is sort-able. You shouldn't be able to move a group into a field list, or a field into the group list.

<div dnd-sortable-container [sortableData]="module.groups" class="group card" *ngFor="let group of module.groups; let i = index">
    <div class="card-block" dnd-sortable [sortableIndex]="i">
        <div class="card-title">
            <h5>{{ group.name }}</h5>
        </div>
        <div>
            <div dnd-sortable-container [sortableData]="group.fields" *ngFor="let field of group.fields; let i = index">
                <div dnd-sortable [sortableIndex]="i">
                    <span class="text-capitalize">{{ field.name }} - {{ field.type }}</span>
                </div>
            </div>
        </div>
    </div>
</div>

I tried to use drop zones with the sort-able tags but I get errors "Can't bind to 'dropZones' since it isn't a known property of 'div'."

Is it possible to get such a setup working?

Please tell us about your environment:

marcosbeto commented 8 years ago

Did you find how to solve it?

LeahPike commented 8 years ago

I haven't, sorry :(

Gillardo commented 7 years ago

Any news on this?

geoffles commented 7 years ago

20 - would like this too

niravpatel9898 commented 7 years ago

Check this example out.

In this example (No.13) if you observe carefully, You have to set [dragEnable] as false whenever you want the inner sortable container's drag and drop to work.

Trapulo commented 6 years ago

ok, but this will not provide a real "inner + outer resorting" user experience...

Trapulo commented 6 years ago

It can be solved using dragEnabled + dropZones + (mousedown)="dragDetails = false; $event.stopPropagation();"

nested list sortables seems working using this kind of schema... but something more native we'll be great

Anoxy commented 6 years ago

any updates on this ? still can't get this working :/

edit.

I managed to get this working by setting dragEnable on parent elements when mouseenter nested sortable , then setting it back again when moseleaving elements.

JustinElst commented 6 years ago

@Anoxy could you provide a plnkr as an example?