The Application object is always available in the app object and it contains a
variety of useful methods.
Properties
| Property |
Type |
Access |
Description |
| location |
Location
|
read only
|
Access to the location object. |
| route |
Route
|
read only
|
Access to the route object. |
| version |
String |
read only
|
The version of the applet in format:major.minor.subminor
|
| loadedKB |
Number |
read only
|
The size of transferred data in this session in KB. |
showMap()
Change display mode to show the map.
showLayer()
Change display mode to show the current layer page.
clearCache()
Clear the resident cache that stores pages, images and geodata.
Next time an item is needed it will be loaded from the server.
call(number : String)
| Parameter |
Type |
Use |
Description |
| number |
String |
required
|
The number that is called. |
Makes a phone call to the specified number.
app.call("+46317790960");
browse(arg : String)
| Parameter |
Type |
Use |
Description |
| arg |
String |
required
|
The URL that should be shown. |
Opens an external browser with the specified URL.
reloadPage()
Reload the current page.
reloadPageParams(params : Object)
| Parameter |
Type |
Use |
Description |
| params |
Object |
|
URL parameters and values. |
Reload the current page with another set of parameters.
Example:
app.reloadPageParams({p1:"value"});
requireSignedIn(showSignInForm : boolean)
| Parameter |
Type |
Use |
Description |
| showSignInForm |
boolean |
|
Whether or not to show the sign in form if the user is not signed in. |
Aborts the script if the user is not signed in. Optionally redirects the user to the sign in form.
A Document keeps the fields in a document and provides a few other methods. The
current document is available in the doc variable.
Properties
| Property |
Type |
Access |
Description |
| fields |
|
read only
|
Returns an object with all fields in the document. These can from this object be accessed by their id.
Example to set the value of a field:doc.fields.value="hej"
|
| handlers |
|
read only
|
Returns an object with all handlers in the document. These can from this object be accessed by their id.
|
link(url : String, replace : boolean, arg? : Object)
| Parameter |
Type |
Use |
Description |
| url |
String |
|
The id of the document. This can be relative to the current document or a complete URL. |
| replace |
boolean |
|
Set to 'true' to load the new URL in the current "window", replacing the current document. Defaults to
'false'. |
| arg |
Object |
default:
|
URL parameters and values. |
Follow a link and open the specified document.
Example:
doc.link({url:"subpage.idoc", arg:{param1:doc.field.f1.value,
param2:"text"}})
back()
Change to the previously used page or map.
doFieldActions(arg : String)
| Parameter |
Type |
Use |
Description |
| arg |
String |
|
A string that should match the id of the fields. A * is allowed in the beginning and in the end of the
string and it matches any characters. |
Executes the actions of all fields which id matches the argument.
A field is an element in a page that usually can be manipulated by the user. The fields are created in IDOC and can
be accessed from IScript by their id. The following example changes the value of the field myField to "hello".
doc.fields.myField.value="hello"
. Fields are represented in IDOCs by sections, images and handlers.
Properties
| Property |
Type |
Access |
Description |
| value |
Object |
|
The current value of the field. The effect on changing the value depends on the type of field. |
| id |
String |
read only
|
The id of the field. |
doAction()
Execute the script associated with the field.
addOption({value : String, label? : String, action? : String})
| Parameter |
Type |
Use |
Description |
| value |
String |
required
|
The value of the option to add. |
| label |
String |
optional
|
The label to display for the option to add. If not specified the value is used as label. |
| action |
String |
optional
|
Action that is executed when the option is selected. |
Add an option to a field. Note, not all fields support options.
removeOption(arg : String)
| Parameter |
Type |
Use |
Description |
| arg |
String |
required
|
The value of the option to remove. |
Remove an option from a field. Note, not all fields support
options.
clearOptions()
Remove all options from the field. Note, not all fields support
options.
inputText()
This method is intended an actions in options in textField. It
changes the mode to text input. This way there can be predefined options and an option to enter text in a text
field.
A Layer is some information that is displayed on the map. It consists of some
sublayers that are configured individually. The current layer is available in the layer variable.
Properties
| Property |
Type |
Access |
Description |
| visible |
boolean |
|
If this value is set to true the layer is displayed when it is the current layer or if this layer is
alwaysVisible. |
| alwaysVisible |
boolean |
|
If this value is set to true the layer is displayed also when it is not the current layer under the
condition that visible is true. |
| currentNametd>
| String |
read only
|
The name of the currently selected object or "" if no object selected. |
| currentX |
|
read only
|
The x-coordinate (longitude) of the currently selected object or "" if no object selected. |
| currentY |
|
read only
|
The y-coordinate (latitude) of the currently selected object or "" if no object selected. |
| doc |
|
read only
|
Accesses the layer's front page. |
set({sublayer : String, visible? : boolean, selectable? : boolean, category? : integer, included? : boolean})
| Parameter |
Type |
Use |
Description |
| sublayer |
String |
required
|
The name of the sublayer where a parameter should be set. |
| visible |
boolean |
optional
|
Change visibility of a sublayer to "true" or "false". |
| selectable |
boolean |
optional
|
Change selectability of a sublayer to "true" or "false". |
| category |
integer |
optional
|
Change visibility of a category of objects in a sublayer. Note, included decides if objects with this
category should be included or not. The category should be a number between 0 and 31. |
| included |
boolean |
optional
|
Change visibility of objects of a certain category that is specified with the category parameter. Note,
by default are all categories visible. |
Set parameters in a sublayer. You can do two things with this:
- Make a sublayer visible or hidden.
- Make objects with a certain category in a sublayer visible or hidden.
This example hides the sublayer myLayer:
layer.set({sublayer:'myLayer', visible:'false'})
This example hides the objects where the category attribute is 3:
layer.set({sublayer:'myLayer', category:3, included:'false'})
This example makes the sublayer myLayer visible, but not selectable:
layer.set({sublayer:'myLayer', visible:'true', selectable:'false'})
load({sublayer? : String, handler? : Field,
disableDistanceSorting? : boolean, arg? : Object})
| Parameter |
Type |
Use |
Description |
| sublayer |
String |
optional
|
The name of the sublayer where data should be loaded. If not specified the first one is used. |
| handler |
Field
|
optional
|
A handler that is called when the server returns with a valid answer. No argument is supplied to the
handler. |
| disableDistanceSorting |
boolean |
default:false
|
If set to true, returned objects will not be sorted on distance to the map center. |
| arg |
Object |
optional
|
The parameters sent to the server. This should be a script object with named parameters. A special
argument, _maxItems, can be used to limit the number of items returned. May be between 0 and 40, and defaults to
10. |
This method is available for dynamic data layers and loads data from the layer's dataset URL. The data is loaded and
prepared via the Locago server, which by default limits the number of items to 10, unless the _maxItems parameter is
provided in the arg object.
layer.load({handler:doc.handlers.wikiresult, arg:{x:map.centerX,
y:map.centerY, radius:10000, _maxItems:20}})
showCurrentObject()
Shows the map and zooms in on the currently selected object.
remove()
Removes this layer.
viewSelection(arg? : boolean)
| Parameter |
Type |
Use |
Description |
| arg |
boolean |
default:false
|
Decides if all objects in the dataset should be selected or only those that are currently visible. |
Selects objects in the layer, shows the map and zooms so that these
are visible.
viewExtent()
Positions the map so that the complete layer extent is visible.
The map handles the geographic display.
Properties
| Property |
Type |
Access |
Description |
| centerX |
Number |
|
The x-value (longitude) of the center coordinate of the map. |
| centerY |
Number |
|
The y-value (latitude) of the center coordinate of the map. |
| scale |
Number |
|
The approximate inverse scale of the map. This means that when the scale is 1:10000 this value is 10000.
|
| xmin |
Number |
read only
|
The left border of the minimal rectangle that encloses the displayed area. |
| ymin |
Number |
read only
|
The lower border of the minimal rectangle that encloses the displayed area. |
| xmax |
Number |
read only
|
The right border of the minimal rectangle that encloses the displayed area. |
| ymax |
Number |
read only
|
The upper border of the minimal rectangle that encloses the displayed area. |
| animate |
boolean |
|
This property decides if map panning and zooming should be animated. |
infoAt({x : Number, y : Number, category : String})
| Parameter |
Type |
Use |
Description |
| x |
Number |
|
Longitude for position to get info on. |
| y |
Number |
|
Lattitude for position to get info on. |
| category |
String |
|
Type of information requested. Should be one of "street", "city", "region", "country". If not specified
all categories are returned. |
Performs a local reverse geocoding for the specified point and
returns the address information that is currently loaded.