SortableJS / ngx-sortablejs

Angular 2+ binding to SortableJS. Previously known as angular-sortablejs

Home Page:https://sortablejs.github.io/ngx-sortablejs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hi, How to sort in multiple levels?

lybtt opened this issue · comments

commented

I'm using ngx-sortablejs, and I ran into a problem when implementing multi-level sorting.

my data like this:

chapters: [{
title: 'chapter 01',
child: [{
title: 'topic 1-1'
}, {
title: 'topic 1-2'
}]
},
{
title: 'chapter 02',
child: [{
title: 'topic 2-1'
}, {
title: 'topic 2-2'
}]
}]

<div *ngFor="let chapter of chapters" [sortablejs]="chapters" [sortablejsOptions]="itemListOptions">
    <ul *ngFor="let topic of chapter.child" [sortablejs]="chapter.child" [sortablejsOptions]="itemListOptionsChild">
        
    </ul>
</div>

my question is: how can I get the chapter.child in itemListOptionsChild > onUpdate()?
I need to get the currently selected array to sort.

(my English is not good, please forgive me)

commented

I see the demo(https://stackblitz.com/edit/angular-ptu94s), should I use component to implement multi-level sorting?