title: How to use core-drag-drop in Dart to make a Polymer Element Draggable?
body: <p>I'm trying to make a Polymer Dart element draggable, and swap info with another item in a list.  My latest attempt is using &lt;core-drag-drop&gt; element.  I'm using the events created by this element of trackstart, track, and trackend.  I can get them to fire, but I'm unable to figure out how to get a visual representation of the drag effect, like you can with regular &lt;div&gt; elements by setting their draggable attribute to true.  Not only that I can't figure out how I'm supposed to get info out of these JS events.  I have managed to get some data from the Dart event, but I'm sure there is some missing data set by the &lt;core-drag-drop&gt; element, (or is there?).</p>
  
  
  
  <pre class="lang-dart prettyprint-override"><code>&lt;link rel="import" href="../../packages/polymer/polymer.html"&gt;
  
  &lt;link rel="import" href="../../packages/core_elements/core_drag_drop.html"&gt;
  
  &lt;link rel="import" href="draggable-item.html"&gt;
  
  &lt;polymer-element name="item-list"&gt;
      &lt;template&gt;
          &lt;core-drag-drop&gt;&lt;/core-drag-drop&gt;
          &lt;draggable-item id="item1" on-trackstart="{{ dragStart }}" on-track="{{ dragIt }}" on-trackend="{{ dragEnd }}"&gt;&lt;/draggable-item&gt;
          &lt;draggable-item id="item2" on-trackstart="{{ dragStart }}" on-track="{{ dragIt }}" on-trackend="{{ dragEnd }}"&gt;&lt;/draggable-item&gt;
      &lt;/template&gt;
      &lt;script type="application/dart"&gt;
        import 'dart:html';
  
        import 'package:polymer/polymer.dart';
  
        @CustomTag('item-list')
        class ItemList extends PolymerElement {
          ItemList.created() : super.created();
  
          ...
  
          dragStart(Event ev) {
              print("dragStart: ${ev.currentTarget.id}");
          }
  
  
          dragIt(Event ev) {
              print("dragIt: ${ev.path}");
          }
  
          dragStop(Event ev) {
              print("dragStop $ev, ${ev.target.id}, ${ev.path}");
  
          }
        }
      &lt;/script&gt;
  &lt;/polymer-element&gt;
  </code></pre>
  
  <p>This works in printing out info, but still leaves me clueless on how I can use this to drag an item over another, highlighting targets as they are dragged over, and then swapping info with the end target.  This is in aid of swapping the order of items in a list.  A bit like the Google Play Music app, where you can drag a song and drop it in a different position in the play queue.  Can someone help me here?</p>
  
  <p>UPDATE (Clarification)
  I'm wanting to make a Polymer Dart Element draggable.  The &lt;core-drag-drop&gt; demo.html is for dragging &lt;div&gt; elements.  I can get drag and drop to work on &lt;div&gt; fine in Dart.</p>