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

Without ID, an unusual behavior occurs when moving between lists #45

Open
dennismetz opened this issue Aug 30, 2023 · 0 comments
Open

Comments

@dennismetz
Copy link

dennismetz commented Aug 30, 2023

Without an id field in the object, transferring an entry between lists is not functional.
As a result, some entries may suddenly disappear or be deleted.

Component: https://pastebin.com/b9x1FF1Q

	<div class="row">
		<div class="col-6">
			<VueDraggable
				class="list-group"
				v-model="list1"
				animation="150"
				ghostClass="ghost"
				group="people"
			>
				<div
					v-for="item in list1"
					:key="item.no-id"
					class="list-group-item"
				>
					{{ item.name }}
				</div>
			</VueDraggable>
		</div>
		<div class="col-6">
			<VueDraggable
				class="list-group"
				v-model="list2"
				animation="150"
				group="people"
				ghostClass="ghost"
			>
				<div
					v-for="item in list2"
					:key="item.no-id"
					class="list-group-item"
				>
					{{ item.name }}
				</div>
			</VueDraggable>
		</div>
	</div>
</template>

<script setup>
import { ref } from 'vue'
import { VueDraggable } from 'vue-draggable-plus'
const list1 = ref([
	{
		"name": "test",
		"no-id": "employees.id"
	},
	{
		"name": "active",
		"no-id": "employees.active"
	},
	{
		"name": "firstname",
		"no-id": "employees.firstname"
	},
	{
		"name": "lastname",
		"no-id": "employees.lastname"
	}
])
const list2 = ref([
	{
		"name": "short",
		"no-id": "employees.short"
	},
	{
		"name": "birthday",
		"no-id": "employees.birthday"
	},
	{
		"name": "number",
		"no-id": "employees.number"
	},
	{
		"name": "fullname",
		"no-id": "employees.fullname"
	}
])
</script>
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