vue-dnd-zone icon indicating copy to clipboard operation
vue-dnd-zone copied to clipboard

Whats the setup for auto scrolling within an compnent?

Open 1Luc1 opened this issue 3 years ago • 6 comments

I'm having the following setup:

<template>
  <v-container style=" overflow-y: scroll; height: 90vh">
    <dnd-zone :transition-duration="0.3" @move="move" :native-scroll="false">
      <dnd-container :dnd-model="selectedFields" dnd-id="grid-example" class="row">
        <dnd-item v-for="field in selectedFields" :key="field._id" :dnd-id="field._id" :dnd-model="field">
          <v-col cols="4">
            <v-card>
              <v-card-text>{{field.label.de}}</v-card-text>
            </v-card>
          </v-col>
        </dnd-item>
      </dnd-container>
    </dnd-zone>
  </v-container>
</template>

selectedFields has a lot of elements. Drag&Drop elements from top to bottom doesn't work. After some tests, it seems it only works, if overflow / scrollbar only on the html tag. So how to setup drag and drop within an e.g. container with fix height.

1Luc1 avatar Jan 19 '22 18:01 1Luc1

Set native-scroll prop to false

supraniti avatar Feb 14 '22 19:02 supraniti

thanks for your reply; as you can see within the provided code, the native-scroll prop is already set to false. changing it to true also doesn't work. I still think that's manly a problem about how to set up the surrounding containers right?!?!

1Luc1 avatar Feb 15 '22 08:02 1Luc1

OK... :-) i got mixed up with another D&D library i developed which has the ability to scroll whitin an inner container... In vue-dnd-zone this is not possible, native scroll applies to scrolling the body element only. not any container.

supraniti avatar Mar 07 '22 14:03 supraniti

ok, thanks. so how should the vue-dnd-zone be use? Should it directly be below the body tag? Can't find a full example.

1Luc1 avatar Mar 07 '22 14:03 1Luc1

vue-dnd-zone can be set anywhere in the document. it doesn't have the ability to trigger inner container scrolling - so you should avoid your content height/width overflows the container dimensions. it is working fine however when the scrolled container is the body. you can try running https://supraniti.github.io/vue-dnd-zone/ (first page is also a draggable example) in a small window and see scrolling in action

supraniti avatar Mar 08 '22 15:03 supraniti

now i know what you are saying. I'm trying to setup this behavior and may report back on this. Anyway, it would be cool if you could provide an example code how to setup/define your examples...

1Luc1 avatar Mar 08 '22 16:03 1Luc1