[Project_owners] drag and drop

Eric H. Jung eric.jung at yahoo.com
Sun Apr 2 14:12:40 EDT 2006


Hi,

I'm trying to get items dragged in a <tree/> to change style while dragged. Here's what I have.
Note I'm *not* using the nsDragAndDrop.js wrapper.

treechildren::-moz-tree-row(dropOn) {
  background: red !important;
}
treechildren::-moz-tree-row(dropOff) {
  background: white !important; /* I know this isn't the right "default" style */
}

var treeObserver = {
  startDrag : function(event) { ... },
  dragOver : function(event) {
    ...
    ...
    var destRow = myTree.treeBoxObject.getRowAt(event.clientX, event.clientY);
    myTree.view.getItemAtIndex(destRow).firstChild.setAttribute("properties", "dropOn");
  },
  dragExit : function(event) {
    var destRow = myTree.treeBoxObject.getRowAt(evt.clientX, evt.clientY);
    myTree.view.getItemAtIndex(destRow).firstChild.setAttribute("properties", "dropOff");         
  
  },
  drop : function(evt) {
    var destRow = treeInfo.tree.treeBoxObject.getRowAt(evt.clientX, evt.clientY);
    treeInfo.tree.view.getItemAtIndex(destRow).firstChild.setAttribute("properties", "dropOff");  
         
    ...
    ...
  }
};

<tree ...><treecols ...><treecol .../></treecols/><template><rule>
  <treechildren
     ondragdrop="treeObserver.drop(event);"
     ondraggesture="treeObserver.startDrag(event);"
     ondragover="treeObserver.dragOver(event);"
     ondragexit="treeObserver.dragExit(event);">
  ...
  ...

What happens is the rows turn red but never white (dropOff). Anyone know what I'm doing wrong, or
could point me to a <tree/> which uses drag-and-drop?

Thanks in advance,
Eric Jung


More information about the Project_owners mailing list