Child pages
  • JSDNDEvent

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
{div:style=}
Wiki Markup
Div
styledisplay:none

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.

\\ \\ Enter additional information related to this



Enter additional information related to this 'class'

inside

the

\

{div}

macro

with

'id=description'

{div} {div:id=description}{div}\\ {table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Constants Summary{th}{tr}{tbody}{tr}{td}[String]{td}{td}[#ACTION] Constant returned by JSEvent.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#DATACHANGE] Constant returned by JSEvent.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#DOUBLECLICK] Constant returned by JSEvent.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#FOCUSGAINED] Constant returned by JSEvent.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#FOCUSLOST] Constant returned by JSEvent.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#FORM] Constant returned by JSEvent.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#MODIFIER_ALT] Constant for the ALT modifier that can be returned by JSDNDEvent.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#MODIFIER_CTRL] Constant for the CTRL modifier that can be returned by JSDNDEvent.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#MODIFIER_META] Constant for the META modifier that can be returned by JSDNDEvent.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#MODIFIER_SHIFT] Constant for the SHIFT modifier that can be returned by JSDNDEvent.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#NONE] Constant returned by JSEvent.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#ONDRAG] Constant returned by JSDNDEvent.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#ONDRAGEND] Constant returned by JSDNDEvent.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#ONDRAGOVER] Constant returned by JSDNDEvent.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#ONDROP] Constant returned by JSDNDEvent.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#RIGHTCLICK] Constant returned by JSEvent.{td}{tr}{tbody}{table}\\ {table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Property Summary{th}{tr}{tbody}{tr}{td}[Object]{td}{td}[#data] A data object that specific events can set, a user can set data back to the system for events that supports this.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#dataMimeType] The event data mime type.{td}{tr}{tbody}{table}\\ {table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[Number]{td}{td}[#getDragResult]\() Returns the result of the drag action.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getElementName]\() returns the name of the element, can be null if the form was the source of the event.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getFormName]\() returns the name of the form the element was placed on.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getModifiers]\() Returns the modifiers of the event, see JSDNDEvent.{td}{tr}{tbody}{tbody}{tr}{td}[JSRecord]{td}{td}[#getRecord]\() Returns the record of the event.{td}{tr}{tbody}{tbody}{tr}{td}[Object]{td}{td}[#getSource]\() returns the source component/element of the event.{td}{tr}{tbody}{tbody}{tr}{td}[Date]{td}{td}[#getTimestamp]\() Returns the time the event occurred.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getType]\() returns the dnd event type see the JSDNDEvents constants what it can return.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getX]\() Returns the x position of the event, relative to the component that fired it, if applicable.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getY]\() Returns the y position of the event, relative to the component that fired it, if applicable.{td}{tr}{tbody}{table}\\ {table:id=constant|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Constants Details{th}{tr}{tbody:id=ACTION}{tr:id=name}{td}h6.ACTION{td}{tr}{tr:id=des}{td}{div:class=sIndent}Constant returned by JSEvent.getType() in a method that is attached to an onAction event.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}

Div
iddescription


HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Constants Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#ACTION
Constant returned by JSEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#DATACHANGE
Constant returned by JSEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#DOUBLECLICK
Constant returned by JSEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#FOCUSGAINED
Constant returned by JSEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#FOCUSLOST
Constant returned by JSEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#FORM
Constant returned by JSEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#MODIFIER_ALT
Constant for the ALT modifier that can be returned by JSDNDEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#MODIFIER_CTRL
Constant for the CTRL modifier that can be returned by JSDNDEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#MODIFIER_META
Constant for the META modifier that can be returned by JSDNDEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#MODIFIER_SHIFT
Constant for the SHIFT modifier that can be returned by JSDNDEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#NONE
Constant returned by JSEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#ONDRAG
Constant returned by JSDNDEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#ONDRAGEND
Constant returned by JSDNDEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#ONDRAGOVER
Constant returned by JSDNDEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#ONDROP
Constant returned by JSDNDEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#RIGHTCLICK
Constant returned by JSEvent.

HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)
#data
A data object that specific events can set, a user can set data back to the system for events that supports this.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#dataMimeType
The event data mime type.

HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getDragResult()
Returns the result of the drag action.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getElementName()
returns the name of the element, can be null if the form was the source of the event.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getFormName()
returns the name of the form the element was placed on.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getModifiers()
Returns the modifiers of the event, see JSDNDEvent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSRecord
Table Cell (td)
#getRecord()
Returns the record of the event.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)
#getSource()
returns the source component/element of the event.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Date
Table Cell (td)
#getTimestamp()
Returns the time the event occurred.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getType()
returns the dnd event type see the JSDNDEvents constants what it can return.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getX()
Returns the x position of the event, relative to the component that fired it, if applicable.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getY()
Returns the y position of the event, relative to the component that fired it, if applicable.

HTML Table
idconstant
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Constants Details
Table Body (tbody)
idACTION
Table Row (tr)
idname
Table Cell (td)
ACTION
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant returned by JSEvent.getType() in a method that is attached to an onAction event.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

if (event.getType() == JSEvent.ACTION) 
{
	// its an action event.
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idDATACHANGE
Table Row (tr)
idname
Table Cell (td)
DATACHANGE
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant returned by JSEvent.getType()

...

in

...

a

...

method

...

that

...

is

...

attached

...

to

...

an

...

onDataChange

...

event.

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

if (event.getType() == JSEvent.DATACHANGE) 
{
	// its a data change event
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idDOUBLECLICK
Table Row (tr)
idname
Table Cell (td)
DOUBLECLICK
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant returned by JSEvent.getType()

...

in

...

a

...

method

...

that

...

is

...

attached

...

to

...

an

...

onDoubleClick

...

event.

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

if (event.getType() == JSEvent.DOUBLECLICK) 
{
	// its a double click event.
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idFOCUSGAINED
Table Row (tr)
idname
Table Cell (td)
FOCUSGAINED
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant returned by JSEvent.getType()

...

in

...

a

...

method

...

that

...

is

...

attached

...

to

...

an

...

onFocusGained

...

or

...

the

...

forms

...

onElementFocusGained

...

event.

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

if (event.getType() == JSEvent.FOCUSGAINED) 
{
	// its a focus gained event.
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idFOCUSLOST
Table Row (tr)
idname
Table Cell (td)
FOCUSLOST
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant returned by JSEvent.getType()

...

in

...

a

...

method

...

that

...

is

...

attached

...

to

...

an

...

onFocusLost

...

or

...

the

...

forms

...

onElementFocusLost

...

event.

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

if (event.getType() == JSEvent.FOCUSLOST) 
{
	// its a focus lost event.
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idFORM
Table Row (tr)
idname
Table Cell (td)
FORM
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant returned by JSEvent.getType()

...

in

...

a

...

method

...

that

...

is

...

attached

...

to

...

a

...

form

...

event

...

(like

...

onShow)

...

or

...

command

...

(like

...

onDeleteRecord)

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

if (event.getType() == JSEvent.FORM) 
{
	// its a form event or command
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idMODIFIER_ALT
Table Row (tr)
idname
Table Cell (td)
MODIFIER_ALT
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant for the ALT modifier that can be returned by JSDNDEvent.getModifiers();

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

//test if the SHIFT modifier is used.
if (event.getModifiers() & JSDNDEvent.MODIFIER_SHIFT)
{
	//do shift action
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idMODIFIER_CTRL
Table Row (tr)
idname
Table Cell (td)
MODIFIER_CTRL
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant for the CTRL modifier that can be returned by JSDNDEvent.getModifiers();

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

//test if the SHIFT modifier is used.
if (event.getModifiers() & JSDNDEvent.MODIFIER_SHIFT)
{
	//do shift action
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idMODIFIER_META
Table Row (tr)
idname
Table Cell (td)
MODIFIER_META
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant for the META modifier that can be returned by JSDNDEvent.getModifiers();

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

//test if the SHIFT modifier is used.
if (event.getModifiers() & JSDNDEvent.MODIFIER_SHIFT)
{
	//do shift action

...

}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idMODIFIER_SHIFT
Table Row (tr)
idname
Table Cell (td)
MODIFIER_SHIFT
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant for the SHIFT modifier that can be returned by JSDNDEvent.getModifiers();

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

//test if the SHIFT modifier is used.
if (event.getModifiers() & JSDNDEvent.MODIFIER_SHIFT)
{
	//do shift action
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idNONE
Table Row (tr)
idname
Table Cell (td)
NONE
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant returned by JSEvent.getType()

...

if

...

the

...

event

...

is

...

not

...

used

...

in

...

a

...

known

...

event

...

or

...

command.

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

if (event.getType() == JSEvent.NONE) 
{
	// type is not set.
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idONDRAG
Table Row (tr)
idname
Table Cell (td)
ONDRAG
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant returned by JSDNDEvent.getType()

...

in

...

a

...

method

...

that

...

is

...

attached

...

to

...

an

...

onDrag

...

event.

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

if (event.getType() == JSDNDEvent.ONDRAG) 
{
	// its an ondrag event
	if (event.getElementName() == 'todragelement')
		return DRAGNDROP.COPY
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idONDRAGEND
Table Row (tr)
idname
Table Cell (td)
ONDRAGEND
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant returned by JSDNDEvent.getType()

...

in

...

a

...

method

...

that

...

is

...

attached

...

to

...

an

...

onDragEnd

...

event.

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

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)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idONDRAGOVER
Table Row (tr)
idname
Table Cell (td)
ONDRAGOVER
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant returned by JSDNDEvent.getType()

...

in

...

a

...

method

...

that

...

is

...

attached

...

to

...

an

...

onDragOver

...

event.

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

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)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idONDROP
Table Row (tr)
idname
Table Cell (td)
ONDROP
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant returned by JSDNDEvent.getType()

...

in

...

a

...

method

...

that

...

is

...

attached

...

to

...

an

...

onDrop

...

event.

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

if (event.getType() == JSDNDEvent.ONDROP) 
{
	// its a on drop event.
	var element = elements[event.getElementName()];
	// do drop on element
	return true;
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idRIGHTCLICK
Table Row (tr)
idname
Table Cell (td)
RIGHTCLICK
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant returned by JSEvent.getType()

...

in

...

a

...

method

...

that

...

is

...

attached

...

to

...

an

...

onRightClick

...

event.

...

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

if (event.getType() == JSEvent.RIGHTCLICK) 
{
	// its a right click event.
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)


HTML Table
idproperty
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Property Details
Table Body (tbody)
iddata
Table Row (tr)
idname
Table Cell (td)
data
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
A data object that specific events can set, a user can set data back to the system for events that supports this.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Object
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

// 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;

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
iddataMimeType
Table Row (tr)
idname
Table Cell (td)
dataMimeType
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The event data mime type.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

// 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;
}
Table Row (tr)
classlastDetailRow
Table Cell (td)


HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idgetDragResult
Table Row (tr)
idname
Table Cell (td)
getDragResult
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getDragResult
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the result of the drag action.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number – a DRAGNDROP constant, representing the result of the drag action
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

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
	}
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getElementName}{tr:id=name}{td}h6.getElementName{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getElementName{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}returns the name of the element, can be null if the form was the source of the event.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- a String representing the element name.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetElementName
Table Row (tr)
idname
Table Cell (td)
getElementName
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getElementName
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
returns the name of the element, can be null if the form was the source of the event.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String – a String representing the element name.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

if (event.getElementName() == 'myElement')
{
    elements[event.getElementName()].bgcolor = '#ff0000';
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getFormName}{tr:id=name}{td}h6.getFormName{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getFormName{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}returns the name of the form the element was placed on.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- a String representing the form name.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetFormName
Table Row (tr)
idname
Table Cell (td)
getFormName
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getFormName
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
returns the name of the form the element was placed on.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String – a String representing the form name.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

forms[event.getFormName()].myFormMethod();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getModifiers}{tr:id=name}{td}h6.getModifiers{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}getModifiers{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns the modifiers of the event, see JSDNDEvent.MODIFIER\_XXXX for the modifiers that can be returned.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- an int which holds the modifiers as a bitset.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetModifiers
Table Row (tr)
idname
Table Cell (td)
getModifiers
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getModifiers
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the modifiers of the event, see JSDNDEvent.MODIFIER_XXXX for the modifiers that can be returned.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number – an int which holds the modifiers as a bitset.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

//test if the SHIFT modifier is used.
if (event.getModifiers() & JSDNDEvent.MODIFIER_SHIFT)
{
	//do shift action
} {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getRecord}{tr:id=name}{td}h6.getRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSRecord]{span}{span:style=font-weight: bold;}getRecord{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns the record of the event.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSRecord] -- Record of the event{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}

}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetRecord
Table Row (tr)
idname
Table Cell (td)
getRecord
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSRecord
Span
stylefont-weight: bold;
getRecord
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the record of the event.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
JSRecord – Record of the event
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

event.Record();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getSource}{tr:id=name}{td}h6.getSource{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Object]{span}{span:style=font-weight: bold;}getSource{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}returns the source component/element of the event. If it has a name the getElementName() is the name of this component.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Object] -- an Object representing the source of this event.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetSource
Table Row (tr)
idname
Table Cell (td)
getSource
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Object
Span
stylefont-weight: bold;
getSource
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
returns the source component/element of the event.
If it has a name the getElementName() is the name of this component.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Object – an Object representing the source of this event.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

// 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();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getTimestamp}{tr:id=name}{td}h6.getTimestamp{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Date]{span}{span:style=font-weight: bold;}getTimestamp{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns the time the event occurred.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Date] -- a Date when this event happened.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetTimestamp
Table Row (tr)
idname
Table Cell (td)
getTimestamp
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Date
Span
stylefont-weight: bold;
getTimestamp
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the time the event occurred.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Date – a Date when this event happened.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

event.getTimestamp();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getType}{tr:id=name}{td}h6.getType{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getType{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}returns the dnd event type see the JSDNDEvents constants what it can return.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- a String representing the type of this event.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetType
Table Row (tr)
idname
Table Cell (td)
getType
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getType
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
returns the dnd event type see the JSDNDEvents constants what it can return.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String – a String representing the type of this event.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

if (event.getType() == JSDNDEvent.ONDROP) 
{
	// it's a drop
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getX}{tr:id=name}{td}h6.getX{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}getX{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}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.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- an int representing the X position.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetX
Table Row (tr)
idname
Table Cell (td)
getX
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getX
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
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.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number – an int representing the X position.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var x = event.getX();
var xPrevious = previousEvent.getX();
var movedXPixels = x -xPrevious;
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getY}{tr:id=name}{td}h6.getY{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}getY{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}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.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- an int representing the Y position.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetY
Table Row (tr)
idname
Table Cell (td)
getY
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getY
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
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.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number – an int representing the Y position.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var y = event.getY();
var yPrevious = previousEvent.getY();
var movedYPixels = y -yPrevious;
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}
Table Row (tr)
classlastDetailRow
Table Cell (td)