Search
DragDropEventArgs Constructor
See Also
 






Initializes a new instance of the DragDropEventArgs class.

Namespace: MindFusion.Common.UI
File: EventArgs.js

 Syntax

JavaScript  Copy Code

function DragDropEventArgs (dragItem, dropTarget)

 Parameters

dragItem

ListItem. The item, associated with the event.

dropTarget

Object. An object, containing data about the target of the operation.

 Example

The following code handles the dragDrop event of a ListView class. Event data is provided through the DragDropEventArgs class.

JavaScript  Copy Code

var ui = MindFusion.UI;

// Create a new ListView control.
var list1 = new ui.ListView();

// Add event handler
list1.dragDrop.addEventListener(listDragDrop);

function listDragDrop(sender, args)
{
 var refItem = args.dropTarget.item;
 var refIndex = sender.items.indexOfItem(refItem);
 if (args.dropTarget.position == 1) refIndex += 1;

 var itemIndex = sender.items.indexOfItem(args.dragItem);

 if ((itemIndex < 5) && (refIndex > 5)) args.cancel = true;
 if ((itemIndex > 5) && (refIndex <= 5)) args.cancel = true;
}

 See Also