Documentation

onBeforeDrag

fires before the mouse button is pressed and the cursor is moved over a draggable item

boolean onBeforeDrag(object context,Event native_event){ ... };

Parameters

contextobjectthe drag-n-drop context
native_eventEventan HTML event object

Returns

booleanreturning false will prevent dragging of the element

Example

grida.attachEvent("onBeforeDrag", function(context, ev){
        context.html = "<div style='padding:8px;'>";
        for (var i=0; i< context.source.length; i++){
            context.html += context.from.getItem(context.source[i]).title + "<br>" ;
        }
        context.html += "</div>";
});

Details

If you drag multiple items, the event will be called once, for the entire batch of items.

The drag-and-drop context can have the next properties:

  • from - the source object
  • to - the target object
  • source - the id of the dragged item(s)
  • target - the id of the drop target, null for dropping on empty space
  • start - the id from which DND was started

See also

Back to top