Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to lock vuedraggable for specific array nested level #1242

Open
asmarcin opened this issue Apr 22, 2024 · 0 comments
Open

how to lock vuedraggable for specific array nested level #1242

asmarcin opened this issue Apr 22, 2024 · 0 comments

Comments

@asmarcin
Copy link

asmarcin commented Apr 22, 2024

Hi,
i need advice how to achieve

Code: https://github.com/SortableJS/vue.draggable.next/blob/master/example/components/nested/nested-test.vue

Step by step scenario

i want to enable dragging for only first first level nested elements (i did it with class)

i want to lock dragging elements to top level of array, dragged element should be dropped only inside parent (another element from top level of array)

    elements: [ //top level, i dont want to allow drop here
      {
        id: 1,
        name: "Shrek",
        elements: [] //here should be possible to drop
      },
      {
        id: 2,
        name: "Fiona",
        elements: [ //elements from here should be draggable (i did it with class)
          { 
            id: 4,
            name: "Lord Farquad",
            elements: []
          },
          {
            id: 5,
            name: "Prince Charming",
            elements: []
          }
        ]
      },
      {
        id: 3,
        name: "Donkey",
        elements: [] //here should be possible to drop
      }
    ]
  }

Actual Solution

when im dragging element under element from top level of array its ok, then related context is array from top level, but when i want to drag element in the same row as top level element (should be not allowed) related context is also element from level 1, i tried do some copmaring in :on-move, but its called a lot of times and performance is dying

Expected Solution

allow drop elements only under elements from top level of array, lock dragging element to top level of array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant