...
HTML Table |
---|
|
Table Row (tr) |
---|
| Table Head (th) |
---|
| Method Summary |
|
Table Body (tbody) |
---|
Table Row (tr) |
---|
Table Cell (td) |
---|
#getFormgetForm(name) Gets the specified form object and returns information about the form (see JSForm node). |
|
Table Body (tbody) |
---|
Table Row (tr) |
---|
|
Table Body (tbody) |
---|
Table Row (tr) |
---|
Table Cell (td) |
---|
#getFormsgetForms(datasource) Get an array of forms, that are all based on datasource/servername. |
| tbody |
Table Row (tr) |
---|
Table Cell (td) |
---|
#getFormsgetForms(server, tablename) Get an array of forms, that are all based on datasource/servername and tablename. |
|
Table Body (tbody) |
---|
Table Row (tr) |
---|
| tbody |
Table Body (tbody) |
---|
Table Row (tr) |
---|
| tbody |
Table Body (tbody) |
---|
Table Row (tr) |
---|
| tbody |
Table Body (tbody) |
---|
Table Row (tr) |
---|
|
Table Body (tbody) |
---|
Table Row (tr) |
---|
Table Cell (td) |
---|
#getValueListgetValueList(name) Gets an existing valuelist by the specified name and returns a JSValueList Object that can be assigned to a field. |
| tbody |
Table Body (tbody) |
---|
Table Row (tr) |
---|
Table Cell (td) |
---|
#newFormnewForm(name, dataSource) Creates a new JSForm Object. |
| tbody |
Table Row (tr) |
---|
Table Cell (td) |
---|
#newFormnewGlobalMethod(name, dataSource, styleName, show_in_menu, width, heightscopeName, code) Creates a new JSForm Object. |
|
Table Body (tbody) |
---|
Table Row (tr) |
---|
Table Cell (td) |
---|
#newForm(name, serverName, tableName, styleName, show_in_menu, width, height) Creates a new JSForm Object. |
|
|
Table Body (tbody) |
---|
Table Row (tr) |
---|
Table Cell (td) | #newGlobalMethod(scopeName, code) Creates a new global global method with the specified code in a scope. |
|
Table Body (tbody) |
---|
Table Row (tr) |
---|
| tbody |
Table Row (tr) |
---|
Table Cell (td) |
---|
#newListFormnewListForm(formName, dataSource, textDataProviderID) Creates a new list form, similar to an inset list but without the inset list's header and relation. |
|
Table Body (tbody) |
---|
Table Row (tr) |
---|
Table Cell (td) |
---|
#removeFormnewValueList(name, type) Removes the specified form during Creates a new valuelist with the specified name and number type. |
|
Table Row (tr) |
---|
Table Cell (td) |
---|
removeForm(name) Removes the specified form during the persistent connected client session. |
| tbody |
Table Body (tbody) |
---|
Table Row (tr) |
---|
| tbody |
Table Row (tr) |
---|
Table Cell (td) |
---|
#revertFormrevertForm(name) Reverts the specified form to the original (blueprint) version of the form; will result in an exception error if the form is not an original form. |
|
|
HTML Table |
---|
id | function |
---|
class | servoy sDetail |
---|
|
Table Row (tr) |
---|
| Table Head (th) |
---|
| Method Details |
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Gets the specified form object and returns information about the form (see JSForm node). |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
- the specified name of the form |
|
|
|
|
...
...
var myForm = solutionModel.getForm('existingFormName');
//get the style of the form (for all other properties see JSForm node)
var styleName = myForm.styleName; |
|
|
|
|
|
...
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Get an array of all forms. |
|
|
|
|
...
- an array of JSForm type elements |
|
|
|
|
...
var forms = solutionModel.getForms()
for (var i in forms)
application.output(forms[i].name) |
|
|
|
|
|
...
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Get an array of forms, that are all based on datasource/servername. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
- the datasource or servername |
|
|
|
|
...
- an array of JSForm type elements |
|
|
|
|
...
var forms = solutionModel.getForms(datasource)
for (var i in forms)
application.output(forms[i].name) |
|
|
|
|
|
...
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Get an array of forms, that are all based on datasource/servername and tablename. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
- the datasource or servername {String} tablename |
|
|
|
|
...
...
- an array of JSForm type elements |
|
|
|
|
...
var forms = solutionModel.getForms(datasource,tablename)
for (var i in forms)
application.output(forms[i].name) |
|
|
|
|
|
...
Table Body (tbody) |
---|
id | getGlobalMethod-String_String |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getGlobalMethod |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Gets an existing global method by the specified name. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
- the scope in which the method is searched {String} name |
|
|
|
|
...
- the name of the specified global method |
|
|
|
|
...
...
var method = solutionModel.getGlobalMethod('globals', 'nameOfGlobalMethod');
|
|
|
|
|
|
...
if (method != null) application.output(method.code); |
|
|
|
|
|
...
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getGlobalMethods |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| The list of all global methods. |
|
|
|
|
...
- an array of JSMethod type elements |
|
|
|
|
...
var methods = solutionModel.getGlobalMethods('globals');
|
|
|
|
|
|
...
...
application.output(methods[x].getName()); |
|
|
|
|
|
...
Table Body (tbody) |
---|
id | getGlobalMethods-String |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getGlobalMethods |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| The list of all global methods. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
- limit to global methods of specified scope name |
|
|
|
|
...
- an array of JSMethod type elements |
|
|
|
|
...
var methods = solutionModel.getGlobalMethods('globals');
|
|
|
|
|
|
...
...
application.output(methods[x].getName()); |
|
|
|
|
|
...
Table Body (tbody) |
---|
id | getGlobalVariable-String_String |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getGlobalVariable |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Gets an existing global variable by the specified name. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
- the scope in which the variable is searched {String} name |
|
|
|
|
...
- the specified name of the global variable |
|
|
|
|
...
...
var globalVariable = solutionModel.getGlobalVariable('globals', 'globalVariableName');
application.output(globalVariable.name + " has the default value of " + globalVariable.defaultValue); |
|
|
|
|
|
...
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getGlobalVariables |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Gets an array of all global variables. |
|
|
|
|
...
- an array of JSVariable type elements |
|
|
|
|
...
var globalVariables = solutionModel.getGlobalVariables('globals');
for (var i in globalVariables)
application.output(globalVariables[i].name + " has the default value of " + globalVariables[i].defaultValue); |
|
|
|
|
|
...
Table Body (tbody) |
---|
id | getGlobalVariables-String |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getGlobalVariables |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Gets an array of all global variables. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
- limit to global vars of specified scope name |
|
|
|
|
...
- an array of JSVariable type elements |
|
|
|
|
...
var globalVariables = solutionModel.getGlobalVariables('globals');
for (var i in globalVariables)
application.output(globalVariables[i].name + " has the default value of " + globalVariables[i].defaultValue); |
|
|
|
|
|
...
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns an existing list form. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
...
- the existing list form, or null if it does not exist. |
|
|
|
|
...
var list = solutionModel.getListForm('created_by_sm_2'); |
|
|
|
|
|
...
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Get an array of all list-forms. |
|
|
|
|
...
- an array of IBaseSHList type elements |
|
|
|
|
...
var forms = solutionModel.getListForms()
for (var i in forms)
application.output(forms[i].name) |
|
|
|
|
|
...
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getScopeNames |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Gets an array of all scope names used. |
|
|
|
|
...
- an array of String scope names |
|
|
|
|
...
var scopeNames = solutionModel.getScopeNames();
for (var name in scopeNames)
application.output(name); |
|
|
|
|
|
...
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getValueList |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Gets an existing valuelist by the specified name and returns a JSValueList Object that can be assigned to a field. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
- the specified name of the valuelist |
|
|
|
|
...
...
var myValueList = solutionModel.getValueList('myValueListHere')
//now set the valueList property of your field
//myField.valuelist = myValueList |
|
|
|
|
|
...
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getValueLists |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Gets an array of all valuelists for the currently active solution. |
|
|
|
|
...
- an array of JSValueList objects |
|
|
|
|
...
var valueLists = solutionModel.getValueLists();
if (valueLists != null && valueLists.length != 0)
for (var i in valueLists)
application.output(valueLists[i].name); |
|
|
|
|
|
...
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Creates a new JSForm Object. NOTE: See the JSForm node for more information about form objects that can be added to the new form. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
- the specified name of the form {String} dataSource |
|
|
|
|
...
- the specified name of the datasource for the specified table |
|
|
|
|
...
...
var myForm = solutionModel.newForm('newForm', 'db:/my_server/my_table')
//now you can add stuff to the form (under JSForm node)
//add a label
myForm.newLabel('Name', 1)
//add a "normal" text entry field
myForm.newTextField('dataProviderNameHere', 2) |
|
|
|
|
|
...
...
newGlobalMethod-String_String |
|
|
...
newForm
...
...
...
...
global method with the specified code in a scope. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
scopeName - the scope in which the method is created {String} |
|
|
|
|
...
...
...
...
...
...
...
...
...
...
...
function myglobalmethod(){foundset.newRecord()}') |
|
|
|
|
Table Body (tbody) |
---|
id | newGlobalVariable-String_String_Number |
---|
| |
|
newForm
...
...
...
...
global variable with the specified name and number type. NOTE: |
|
|
|
|
...
The global variable number type is based on the value assigned from the SolutionModel-JSVariable node; for example: JSVariable.INTEGER. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
scopeName - the scope in which the variable is created {String} |
|
|
|
|
...
name - the specified name |
|
|
|
|
...
...
...
...
...
number type for the global variable |
|
|
|
|
...
...
...
myGlobalVariable = solutionModel. |
|
|
|
|
|
...
...
...
...
JSVariable.INTEGER);
myGlobalVariable.defaultValue = 12;
//myGlobalVariable.defaultValue = "{a:'First letter',b:'Second letter'}" // an js object, type must be media.
//myGlobalVariable.defaultValue = '"some text"'; // Use two pairs of quotes if you want to assign a String as default value. |
|
|
|
|
|
...
newListForm-String_String_String |
| |
|
newGlobalMethod
...
...
...
...
dataSource, textDataProviderID) |
|
|
|
|
...
list form, similar to an inset list but without the inset list's header and relation. The result will be an independent form which behaves like a mobile list. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
formName - the new form's name. {String} |
|
|
|
|
...
dataSource - the list will be populated based on this datasource. {String} textDataProviderID - can be null; it's a convenience argument for setting the dataprovider that will be used to populate the main text area of the list's items. |
|
|
|
|
...
JSList - the newly created list form. |
|
|
|
|
...
...
...
...
id | newGlobalVariable-String_String_Number |
---|
Table Row (tr) |
---|
|
Table Cell (td) |
---|
newGlobalVariable |
|
Table Row (tr) |
---|
|
Table Cell (td) |
---|
Span |
---|
(scopeName, name, type) |
|
|
...
...
Creates a new global variable with the specified name and number type.
...
newForm("created_by_sm_1","udm","contacts",null,false,100,380);
// create a button to go to it on the main form
b = f.newButton("Show created list form",0,9,10,10,
f.newMethod("function showListForm() { forms.created_by_sm_2.controller.show(); }"));
// create the actual list form
var list = f.createListForm('created_by_sm_2', databaseManager.getDataSource("udm","contacts"),"name_first");
list.onAction = solutionModel.getForm('created_by_sm_2').newMethod("function goBack() { history.back(); }"); |
|
|
|
|
Table Body (tbody) |
---|
id | newValueList-String_Number |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
newValueList |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Creates a new valuelist with the specified name and number type. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
name - the specified name for the valuelist {Number} type - the specified number type for the |
|
|
|
|
...
valuelist; may be JSValueList.CUSTOM_VALUES, JSValueList.DATABASE_VALUES, JSValueList.EMPTY_VALUE_ALWAYS, JSValueList.EMPTY_VALUE_NEVER |
|
|
|
|
...
...
...
...
...
newValueList("customText",JSValueList.CUSTOM_VALUES);
|
|
|
|
|
|
...
...
...
"customvalue1\ncustomvalue2";
var vl2 = |
|
|
|
|
|
...
solutionModel.newValueList("customid",JSValueList.CUSTOM_VALUES);
vl2.customValues = "customvalue1|1\ncustomvalue2|2";
var form = solutionModel.newForm("customValueListForm",controller.getDataSource(),null,true,300,300);
var combo1 = form.newComboBox("scopes.globals.text",10,10,120,20);
combo1.valuelist = vl1;
var combo2 = form.newComboBox("scopes.globals.id",10,60,120,20);
combo2.valuelist = vl2; |
|
|
|
|
|
...
...
newListForm
...
...
...
...
Removes the specified form during the persistent connected client session. NOTE: Make sure you call history.remove first in your Servoy method (script). |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
name - the specified name of the form to remove |
|
|
|
|
...
Boolean - true is form has been removed, false if form could not be removed |
|
|
|
|
...
...
var f = solutionModel.newForm("created_by_sm_1","udm","contacts",null,false,100,380);
// create a button to go to it on the main form
b = f.newButton("Show created list form",0,9,10,10,
f.newMethod("function showListForm() { forms.created_by_sm_2.controller.show(); }"));
// create the actual list form
var list = f.createListForm('created_by_sm_2', databaseManager.getDataSource("udm","contacts"),"name_first");
list.onAction = solutionModel.getForm('created_by_sm_2').newMethod("function goBack() { history.back(); }");
...
...
Table Row (tr) |
---|
|
Table Cell (td) |
---|
Div |
---|
| Removes the specified form during the persistent connected client session. NOTE: Make sure you call history.remove first in your Servoy method (script). |
|
|
Table Row (tr) |
---|
|
Table Cell (td) |
---|
Parameters
Div |
---|
| {String} name – the specified name of the form to remove |
|
|
Table Row (tr) |
---|
|
Table Cell (td) |
---|
Returns
Div |
---|
| Boolean – true is form has been removed, false if form could not be removed |
|
|
...
...
...
...
|
---|
| //first remove it from the current history, to destroy any active form instance
var success = history.removeForm('myForm')
//removes the named form from this session, please make sure you called history.remove() first
if(success)
{
solutionModel.removeForm('myForm')
} |
|
|
|
|
Table Body (tbody) |
---|
id | removeGlobalMethod-String_String |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
removeGlobalMethod |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Removes the specified global method. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} scopeName - the scope in which the method is declared {String} name - the name of the global method to be removed |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| Boolean - true if the removal was successful, false otherwise |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| var m1 = solutionModel.newGlobalMethod('globals', 'function myglobalmethod1(){application.output("Global Method 1");}');
var m2 = solutionModel.newGlobalMethod('globals', 'function myglobalmethod2(){application.output("Global Method 2");}');
var success = solutionModel.removeGlobalMethod('globals', 'myglobalmethod1');
if (success == false) application.output('!!! myglobalmethod1 could not be removed !!!');
var list = solutionModel.getGlobalMethods('globals');
for (var i = 0; i < list.length; i++) {
application.output(list[i].code);
} |
|
|
|
|
|
...
removeGlobalVariable-String_String |
| |
|
removeGlobalMethod
...
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Removes the specified global |
|
|
|
|
...
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
...
variable is declared {String} name |
|
|
|
|
...
...
...
- true if the removal was successful, false otherwise |
|
|
|
|
...
...
...
newGlobalVariable('globals', 'globalVar1' |
|
|
|
|
|
...
, JSVariable.INTEGER);
var |
|
|
|
|
|
...
...
newGlobalVariable('globals', ' |
|
|
|
|
|
...
globalVar2', JSVariable.TEXT);
var success = solutionModel. |
|
|
|
|
|
...
removeGlobalVariable('globals', ' |
|
|
|
|
|
...
globalVar1');
if (success == false) application.output('!!! |
|
|
|
|
|
...
globalVar1 could not be removed !!!');
var list = solutionModel. |
|
|
|
|
|
...
getGlobalVariables('globals');
for (var i = 0; i < list.length; i++) {
|
|
|
|
|
|
...
application.output(list[i].name + '[ ' + list[i].variableType + ']: ' + list[i]. |
|
|
|
|
|
...
...
...
...
removeGlobalVariable
...
...
...
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
...
...
...
- true if the removal was successful, false otherwise |
|
|
|
|
...
...
vlName = "customValueList";
var |
|
|
|
|
|
...
...
...
vlName,JSValueList.CUSTOM_VALUES);
vl.customValues = "customvalue1\ncustomvalue2";
var |
|
|
|
|
|
...
...
removeValueList(vlName);
if |
|
|
|
|
|
...
(status) application.output("Removal has been done.");
else application.output( |
|
|
|
|
|
...
...
...
...
...
);
if (vls != null) {
for (var i = 0; i < |
|
|
|
|
|
...
vls.length; i++) {
application.output( |
|
|
|
|
|
...
...
);
}
application.output("");
} |
|
|
|
|
|
...
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Reverts the specified form to the original (blueprint) version of the form; will result in an exception error if the form is not an original form. NOTE: Make sure you call history.remove first in your Servoy method (script) or call form.controller.recreateUI() before the script ends. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
|
|
...
- the specified name of the form to revert |
|
|
|
|
...
...
// revert the form to the original solution form, removing any changes done to it through the solution model.
var revertedForm = solutionModel.revertForm('myForm')
// add a label on a random place.
revertedForm.newLabel("MyLabel",Math.random()*100,Math.random()*100,80,20);
// make sure that the ui is up to date.
forms.myForm.controller.recreateUI(); |
|
|
|
|
|
...