vue-multiselect icon indicating copy to clipboard operation
vue-multiselect copied to clipboard

Support draggable option to re-order selected items

Open Max64 opened this issue 6 years ago • 9 comments

I have a requirement to implement multiselect with user's ability to reorder selected items by drag-n-drop.

I tried to accomplish this by HTML5 Drag-and-Drop but drag events not fired, i guess due to @mousedown.prevent attrs in Multiselect.vue. Second problem, there is no index in start and finish item elements. Any advices?

`mounted: { var comp = this;

_.each(document.getElementsByClassName('multiselect__tag'), function (el) {

	el.addEventListener(
		'dragstart',
		function (e) {
			e.dataTransfer.effectAllowed = 'move';
			comp.dragElementIndex = parseInt(e.currentTarget.getAttribute('index'));
			return false;
		},
		false
	);

	el.addEventListener(
		'drop',
		function (e) {
			if (e.stopPropagation) e.stopPropagation();
			var dropIndex = parseInt(e.currentTarget.getAttribute('index'));
			move(comp.selectedItems, comp.dragElementIndex, dropIndex);
			comp.dragElementIndex = undefined;

			return false;
		},
		false
	);

})

}`

Max64 avatar Mar 10 '18 19:03 Max64

I’m currently in the middle of rewriting parts of the component to make better use of slots. I think it might be possible once the refactor is done.

shentao avatar Mar 11 '18 22:03 shentao

What is the status of the draggable functionality?

mikefdesign avatar Jan 29 '19 19:01 mikefdesign

Will be possible with v3.0. Can't really predict when exactly v3 will be shipping, but hopefully this quarter.

shentao avatar Jan 30 '19 08:01 shentao

Did you find any solutions for this?

aimen-zenasni avatar Aug 29 '19 08:08 aimen-zenasni

I don’t think there’s a solution for that yet.

shentao avatar Aug 29 '19 12:08 shentao

Can I pick this up?

dchinu97 avatar Jun 22 '20 18:06 dchinu97

@dchinu97 I don’t think we need that in the core itself... However, with the v3 changes, I think this is perfectly possible in the userland. Check out the v3 branch and see the new docs. The last example shows how vue-multiselect can be used as a set of 2 tables. I think we could have an example in the docs on how to add drag-n-drop if someone needs that. Maybe we could have something like recipes section?

shentao avatar Jun 23 '20 10:06 shentao

@shentao Can you please provide an example or any reference(docs) that how to add re-ordering of tags in multiselect vue? Thank you in advance.

mehdimohammadijan avatar Nov 19 '21 19:11 mehdimohammadijan

Hello, is there any news on this, please? 🙏

USMortality avatar Jan 23 '24 09:01 USMortality