DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING. THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.
if (event.getType() == JSDNDEvent.ONDRAGEND)
{
// its an on drag end event.
// return true if the drop has been completed successfully
return event.isDropSuccess();
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Table Body (tbody)
id
ONDRAGOVER
Table Row (tr)
id
name
Table Cell (td)
ONDRAGOVER
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Constant returned by JSDNDEvent.getType() in a method that is attached to an onDragOver event.
if (event.getType() == JSDNDEvent.ONDRAGOVER)
{
// its an on drag over event.
// return true if it over the right element.
return event.getElementName() == 'candroponelement';
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Table Body (tbody)
id
ONDROP
Table Row (tr)
id
name
Table Cell (td)
ONDROP
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Constant returned by JSDNDEvent.getType() in a method that is attached to an onDrop event.
if (event.getType() == JSDNDEvent.ONDROP)
{
// its a on drop event.
var element = elements[event.getElementName()];
// do drop on element
return true;
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Table Body (tbody)
id
RIGHTCLICK
Table Row (tr)
id
name
Table Cell (td)
RIGHTCLICK
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Constant returned by JSEvent.getType() in a method that is attached to an onRightClick event.
// A client design method that handles ondrag
if (event.getType() == JSEvent.ONDRAG)
{
// the data is the selected elements array
var elements = event.data;
// only start a client design drag when there is 1 element
if (elements.length == 1)
{
return true;
}
}
// code for a data drag method
event.data = "drag me!";
return DRAGNDROP.COPY;
// code for a data drop method
var data = event.data;
elemements[event.getElementName()].setText(data);
return true;
// only accept drag if data is a servoy record
function onDragOver(event)
{
if(event.dataMimeType.indexOf("application/x-servoy-record-object") == 0) return true;
else return false;
}
Number - a DRAGNDROP constant, representing the result of the drag action
Table Row (tr)
id
sam
Table Cell (td)
Sample
Div
class
sIndent
Code Block
language
javascript
function onDragEnd(event)
{
var dragResult = event.getDragResult();
if(dragResult == DRAGNDROP.NONE)
{
// the drag was canceled
}
else if(dragResult == DRAGNDROP.COPY)
{
// the drag ended with a copy action
}
else if(dragResult == DRAGNDROP.MOVE)
{
// the drag ended with a move action
}
}
returns the source component/element of the event. If it has a name the getElementName() is the name of this component.
Table Row (tr)
id
ret
Table Cell (td)
Returns
Div
class
sIndent
Object - an Object representing the source of this event.
Table Row (tr)
id
sam
Table Cell (td)
Sample
Div
class
sIndent
Code Block
language
javascript
// cast to runtime text field (change to anoter kind of type if you know the type)
/** @type {RuntimeTextField} */
var source = event.getSource();
var sourceDataProvider = source.getDataProviderID();
Returns the x position of the event, relative to the component that fired it, if applicable. For example drag'n'drop events will set the x,y positions.
Returns the y position of the event, relative to the component that fired it, if applicable. For example drag'n'drop events will set the x,y positions.