# Drag and drop to list component

**URL:** <https://forum.inductiveautomation.com/t/drag-and-drop-to-list-component/44077>\
**Category:** Ignition\
**Created:** [March 4, 2021, 5:51am UTC](https://forum.inductiveautomation.com/t/drag-and-drop-to-list-component/44077 "2021-03-04T05:51:54Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 5, 2021, 4:54pm UTC](https://forum.inductiveautomation.com/t/drag-and-drop-to-list-component/44077/16 "2021-03-05T16:54:22Z")

</div>

> [@paul-griffith](#):
>
> Huh, I could’ve sworn we added tag dropping to the tables…

Perhaps you were correct?

This turned out to be a bit simpler than I was originally thinking. Not trivial, but not really painful either.

Add an extension function to your list component, I called mine addDropListener. Then in the script add the following script:

```auto
from java.awt.dnd import DropTargetAdapter, DropTarget
from com.inductiveautomation.ignition.client.tags.dnd import ListOfQualifiedPath
	
class customDragDropListener(DropTargetAdapter):
	_comp = None
	def __init__ (self,comp):
		DropTargetAdapter. __init__ (self)
		self._comp = comp
			
	def drop(self,e):
		e.acceptDrop(e.getDropAction())
		paths = [[path] for path in e.getTransferable().getTransferData(ListOfQualifiedPath.FLAVOR)]
		self._comp.data = system.dataset.addRows(self._comp.data,paths)
			
ddl = customDragDropListener(self)
DropTarget(self,ddl)

```

Then in the internalFrameActivated Event Handler on the window use the following script

NOTE: You will need to change the path for the component to be valid for your system.

```auto
tagList = system.gui.getParentWindow(event).getComponentForPath('Root Container.List')

if not tagList.getDropTarget():
    tagList.addDropListener()

```

Select any number of tags in the Tag Browse Tree component drop them on the list and they will be appended to the list's dataset. It doesn't validate incoming paths against pre-existing paths so you can add duplicates, if you want this functionality you'll need to add it to the drop function.

---

_[View the full topic](https://forum.inductiveautomation.com/t/drag-and-drop-to-list-component/44077)._
