Making Sections and rows with SortableJS Svelte

48 Views Asked by At

REPL

I am trying to create sections and rows with SortableJS in svelte. I want to be able to reorder sections, reorder rows within sections, and drag rows to new sections. I cannot figure out how to set the new order of the nested items in the section.

I have provided a REPL above. Moving the sections works and you can see that the underlying data's order changes. But with the rows I get an error. I don't know how to access the items within the section on sortRow

Here is my data structure.

    let stages =[
    {
        id: 1,
        section: "SECTION",
    items: [
        { id: 1 },
        { id: 2 },
        { id: 3 },
    ]
    },
    {
        id: 11,
        section: "SECTION2",
    items: [
        { id: 4 },
        { id: 5 },
        { id: 6 },
    ]
    }
]

0

There are 0 best solutions below