Can a placeholder dropzone be created at the bottom of Vue Draggable lists?

Currently, I am utilizing Vue.Draggable (accessible at https://github.com/SortableJS/Vue.Draggable) to develop a kanban board that enables me to drag items from one list to another. A challenge I face is that when dragging a list item to the bottom of another list, it does not get added unless the mouse cursor touches an item in the second list while moving.

I am aware that setting ':empty-insert-threshold' for an empty list can expand the drop area to facilitate dropping items, but is there a way to achieve the same effect at the bottom of a non-empty list? If not, could we include a placeholder element to assist users in easily dropping the list item at the bottom of the list?

We have noticed that many users naturally try to place new items at the bottom of lists, which is why enhancing this functionality is crucial for us.

Answer №1

By simply adding extra padding to the bottom of the component, I discovered that it effectively creates a space at the bottom for dropping items and provides a clear visual indicator:

<draggable
   :list="inProgressTaskList" 
   group="tasks"
   @change="onDragChange" 
   itemKey="id"
   style="background: yellow; padding-bottom:200px">

https://i.stack.imgur.com/ML80w.png

The excessive yellowness is purely for demonstration purposes!

Although I am using the updated version for Vue 3, I believe this technique will still be effective in Vue 2.

:o)

Answer №2

I came across a clever solution in the repository's issues that addresses displaying a placeholder for empty elements only when the draggable container is empty. It also considers transitions for groups (although I haven't personally tested this scenario, it seems to be working fine without transitions). Here is the recommended code snippet for reference:

<transition-group type="transition" tag="div">

.list-group:empty,
.list-group > div:empty {
    padding:1rem;
    text-align:center;
}

.list-group:empty:before,
.list-group > div:empty:before {
    content: 'Drop files here';
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Exploring Heroes in Angular 2: Retrieving Object Information by Clicking on <li> Items

Currently, I am delving into the documentation for an angular 4 project called "Tour of Heroes" which can be found at https://angular.io/docs/ts/latest/tutorial/toh-pt2.html. <li *ngFor="let hero of heroes" (click)="onSelect(hero)">{{hero.name}}< ...

AngularJS: Controller isn't being triggered

I'm encountering a peculiar issue with AngularJS where MainCtrl is not functioning at all. When I visit localhost/, it automatically redirects to localhost/#/ but the page remains blank. There are no error messages in the console, and I can confirm th ...

Inertia with Laravel appears to be triggering Vue components to load twice

After creating a Laravel project with Inertia and Vue, I encountered an issue where the code inside my Vue components is executed twice. To demonstrate this problem, I have created a Test.vue, containing the following code: <template> <div> ...

The error "clearRect is not defined in javascript" occurs when the property is being called on an undefined object in the JavaScript

I've encountered a similar question before, but unfortunately, the solution provided didn't help me! I'm relatively new to JavaScript and have been struggling with this issue for nearly a day now without success. The structure of my class a ...

The catch-all route handler is triggered following a response being sent by a designated route handler

Currently, I am facing a peculiar issue with the routing on my Express-based server while trying to implement authentication. Here's a snippet of code that highlights the problem: app.get('/', function (req, res) { console.log('thi ...

Concealing overflow in a sticky container when a fixed child element is present

I am currently working on a website where I have implemented slide-up section panels using position: sticky while scrolling. However, I am encountering issues with fixed elements within the sticky panels not properly hiding outside of the respective sectio ...

A guide on organizing an array of objects by a specific property using a separate array

Here is the array I am working with: var arr = [ { count: 27, dataRil: "08/06/21", subCateg: "FISH", }, { count: 22, dataRil: "08/06/21", subCateg: "DOG", }, { count: 28, dat ...

Nuxt's fetchUser Auth function lacks reactivity and necessitates a manual refresh for updates to take effect

Working with Nuxt 2.15.3 and a Rails backend. I am currently in the process of implementing a Google OAuth workflow in my application, but I have encountered some difficulties with the steps following the retrieval of the access code. After the user succe ...

Is there a way to incorporate a base64 encoded image from a text file into an HTML image?

I have several images stored as base64 blobs in a remote location. Let's focus on one specific image: llorkcir.txt data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxISEhASEBAQDxAQDw8QEA8PEA8PDw0PFRIWFhURFRUYHSggGBolGxUVITEhJSkrLi4uFx8zODMt ...

The Quasar q-form reset button fails to erase the data stored in the form

I'm currently working with quasar q-forms and I am trying to achieve a functionality where the 'Reset' button clears both the values and the validation. Unfortunately, this does not seem to be working as intended. Is there something that I m ...

The process of implementing sticky headers that stay in place while scrolling in a React application

I have a challenge with organizing tables based on date, using headers like (today, yesterday, last week, ...) and I want to make them sticky depending on the current table in the viewport. I attempted to implement this functionality using the react-sticky ...

When the button is clicked, the ng-click event will trigger the addClass function, but only on the second click

My bootstrap alert has this structure: <div id="errorAlert" class="alert col-md-6 col-md-offset-3 fadeAlert" ng-if="itemExistsAlert"> <button type="button" class="close" data-dismiss="alert">&times;</button> <p>{{alertM ...

What is preventing Backbone from triggering a basic route [and executing its related function]?

Presenting My Router: var MyRouter = Backbone.Router.extend({ initialize: function(){ Backbone.history.start({ pushState:true }); }, routes: { 'hello' : 'sayHello' }, sayHello: function(){ al ...

How can you customize the output buffer size (known as highWaterMark) for child_process.spawn() in node.js?

I'm currently working on adjusting the buffer size (highWaterMark) for the stdout coming from a child_process.spawn() function, but I'm encountering difficulties in achieving this successfully. The code snippet provided below demonstrates my obje ...

Converting a JavaScript string into an array or dictionary

Is there a way to transform the following string: "{u'value': {u'username': u'testeuser', u'status': 1, u'firstName': u'a', u'lastName': u'a', u'gender': u'a&a ...

Unexpected issue with Ajax form submission when using the submitHandler function in Jquery

I am faced with the challenge of validating a form using the jQuery Validation Plugin and submitting data to a database without refreshing the page. Despite marking all fields in my form as required, the issue arises where empty fields are still submitted, ...

Instructions on dynamically positioning a collection of div elements at the center of a webpage container

I am looking to create a set of divs that are centered on the page and adjust in size according to the length of the username. .Container1 { display: table; width: 100%; padding:0; margin:0; -webkit-box-sizing: border-box; -moz-box-sizing: bor ...

How can I efficiently utilize the date picker feature in Angular JS for a smooth user experience?

I am new to AngularJS and attempting to implement a date picker. I initially tried using a basic jQuery UI date picker, but it did not function as expected. Can someone please provide me with some code that demonstrates the simplest way to achieve this in ...

Making payments within a Single Page Application using Vue framework

My spa app contains a payment form structured like this: <form Method='post' Action='https://pep.shaparak.ir/gateway.aspx'> invoiceNumber<input type='text' name='invoiceNumber' v-model='InvoiceNum ...

How to showcase base64 encoded images in pug (jade) with node.js

Can anyone help with decoding this mysterious data and displaying the image? I'm using pug as my template engine. Below is the questionable data that needs to be shown as an image: /9j/4AAQSkZJRgABAQEAYABgAAD/4QBaRXhpZgAATU0AKgAAAAgABQ ...and so f ...