Child pages
  • JSMethod

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{hidden}
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE{hidden}
\\ 

{table:id=|class=servoy sSummary}{colgroup}{column:padding=0px|width=80px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Property Summary{th}{tr}{tbody}{tr}{td}[String]{td}{td}[#code]
The full source code of this method (including doc and function declaration).{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#showInMenu]
Flag that tells if the method appears or not in the "Methods" menu of Servoy Client.{td}{tr}{tbody}{table}\\ 

{table:id=|class=servoy sSummary}{colgroup}{column:padding=0px|width=80px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[Object]\[]{td}{td}[#getArguments]\()
gets the argument array for this method if that is set for the specific action this method is taken from.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getName]\()
The name of the method.{td}{tr}{tbody}{tbody}{tr}{td}[UUID]{td}{td}[#getUUID]\()
Returns the UUID of the method object{td}{tr}{tbody}{table}\\ 

{table:id=property|class=servoy sDetail}{colgroup}{column:padding=0px|width=100%}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Property Details{th}{tr}{tbody:id=code|class=node}{tr:id=name}{td}h6.code{td}{tr}{tr:id=des}{td}The full source code of this method (including doc and function declaration).{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\{td}{tr}{tr:id=ret}{td}*Returns*\\ [String]{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var method = form.newFormMethod('function original() { application.output("Original function."); }');
application.output('original method name: ' + method.getName());
application.output('original method code: ' + method.code);
method.code = 'function changed() { application.output("This is another function."); }';
method.showInMenu = false;
var button = form.newButton('Click me!', 10, 10, 100, 30, method);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=showInMenu|class=node}{tr:id=name}{td}h6.showInMenu{td}{tr}{tr:id=des}{td}Flag that tells if the method appears or not in the "Methods" menu of Servoy Client.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\{td}{tr}{tr:id=ret}{td}*Returns*\\ [Boolean]{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var method = form.newFormMethod('function original() { application.output("Original function."); }');
application.output('original method name: ' + method.getName());
application.output('original method code: ' + method.code);
method.code = 'function changed() { application.output("This is another function."); }';
method.showInMenu = false;
var button = form.newButton('Click me!', 10, 10, 100, 30, method);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}\\ 

{table:id=function|class=servoy sDetail}{colgroup}{column:padding=0px|width=100%}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=getArguments|class=node}{tr:id=name}{td}h6.getArguments{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Object]\[]{span}{span:id=iets|style=float: left; font-weight: bold;}getArguments{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}gets the argument array for this method if that is set for the specific action this method is taken from.
Will return null by default. This is only for reading, you can't alter the arguments through this array, 
for that you need to create a new object through solutionModel.newMethodWithArguments(..) and assign it again.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\{td}{tr}{tr:id=ret}{td}*Returns*\\ [Object]\[] -- Array of the arguments, null if not specified.{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var frm = solutionModel.getForm("myForm");
	var button = frm.getButton("button");
 // get the arguments from the button.
 // NOTE: string arguments will be returned with quotes (comp.onAction.getArguments()[0] == '\'foo\' evals to true)
	var arguments = button.onAction.getArguments();
 if (arguments && arguments.length > 1 && arguments[1] == 10) { 
   // change the value and assign it back to the onAction.
   arguments[1] = 50;
   button.onAction = solutionModel.newMethodWithArguments(button.onAction,arguments);
 }
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getName|class=node}{tr:id=name}{td}h6.getName{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getName{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}The name of the method.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\{td}{tr}{tr:id=ret}{td}*Returns*\\ [String] -- A String holding the name of this method.{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var method = form.newFormMethod('function original() { application.output("Original function."); }');
application.output('original method name: ' + method.getName());
application.output('original method code: ' + method.code);
method.code = 'function changed() { application.output("This is another function."); }';
method.showInMenu = false;
var button = form.newButton('Click me!', 10, 10, 100, 30, method);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUUID|class=node}{tr:id=name}{td}h6.getUUID{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[UUID]{span}{span:id=iets|style=float: left; font-weight: bold;}getUUID{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Returns the UUID of the method object{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\{td}{tr}{tr:id=ret}{td}*Returns*\\ [UUID]{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var method = form.newFormMethod('function original() { application.output("Original function."); }');
application.output(method.getUUID().toString());
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}