onBeforeDrag

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

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

webix.ui({
    view:"dashboard", id:"dashboard",
    cells:[
        { view:"panel", x:0, y:0, dx:1, dy:1,
          body:{ template:"Draggable"}, drag:true },
        { view:"panel", x:1, y:0, dx:2, dy:1,
          body:{ template:"Non-draggable"}, drag:false }
});
$$("dashboard").attachEvent("onBeforeDrag", function(context, native_event){
    //returning false will block dragging for some panels
    return context.source.config.drag;
});

Related samples

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 following 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 drag-n-drop was started
See also
Back to top
If you have not checked yet, be sure to visit site of our main product Webix javascript dashboard framework and page of javascript dashboard product.