kony.dragDrop Namespace
The kony.dragdrop Namespace contains the following API elements.
Functions
The kony.dragdrop Namespace contains the following functions.

This function creates a new DragInteraction object and attaches the DragInteraction object to a widget.
Syntax
kony.dragdrop.DragInteraction();
Input Parameters
Parameters | Description |
---|---|
widget | The widget that has to be made draggable. |
callbacks | This is a dictionary with the following keys:
|
Example
//To create a drag interation object use the below code snippet createcallbacksdictAndAddDragInteractionImg1: function() { var callbacksDict = { "itemsForBeggining": this.beginItemDragForm9, "previewForLifting": this.previewForLiftingForm9 }; var argsDict = { "widget": this.view.img1, "callbacks": callbacksDict }; this.dragInteraction1 = new kony.dragdrop.DragInteraction(argsDict); }, /* By specifying the below function, you can return the data, which is to be sent (JSON/filepath).*/ beginItemDragForm9: function() { var applicationDirPath = kony.io.FileSystem.getApplicationDirectoryPath(); var filePath = applicationDirPath + "/puppy.png"; var argsDict = { "data": filePath, "type": kony.dragdrop.ITEMDATA_FILE, "fileVisibility": kony.dragdrop.FILEVISIBILITY_ALL }; return [argsDict]; }, /*By specifying the below function, you can return the preview that is to be shown while dragging on the screen.*/ previewForLiftingForm9: function() { var argsDict = { "preview": this.view.img1 }; return argsDict; },
Return Values
- Success: A newly created DragInteraction object.
- Failure: null
Platform Availability
- iOS 11

This function creates a new DropInteraction object and attaches it to a widget.
Syntax
kony.dragdrop.DropInteraction();
Input Parameters
Parameters | Description |
---|---|
widget | The widget that has to be made droppable. |
callbacks | This is a JSON dictionary with the following keys:
|
Example
//To create a drop interation object use the below code snippet createcallbacksdictAndAddDropInteractionImg2: function() { var callbacksDict = { "performDrop": this.dropCallbackForm9 }; var argsDict = { "widget": this.view.img2, "callbacks": callbacksDict }; this.drpInteraction1 = new kony.dragdrop.DropInteraction(argsDict); }, /*By specifying the below function, you can get the data (JSON/filepath) as an argument*/ dropCallbackForm9: function(recievedData) { var file = kony.io.FileSystem.getFile(recievedData); if (file.exists()) { var fileBytes = file.read(); this.view.img2.base64 = kony.convertToBase64(fileBytes); } },
Return Values
- Success: A newly created DropInteraction object.
- Failure: null
Platform Availability
- iOS 11

This function detaches the DragInteraction object from the widget.
Syntax
kony.dragInteraction.removeDragInteraction();
Input Parameters
None
Example
removeDragInteraction1: function() { this.dragInteraction1.removeDragInteraction(); },
Return Values
None
Platform Availability
- iOS 11

This function detaches the DropInteraction object from the widget.
Syntax
kony.dragInteraction.removeDropInteraction();
Input Parameters
None
Example
removeDropInteraction1: function() { this.drpInteraction1.removeDropInteraction(); }
Return Values
None
Platform Availability
- iOS 11