Home | Take the Tour | Download | Help | Blog | Sign up Already a user? Sign in
Developer Home

MAX Overview


API Reference


Download

MAX Script Reference

Object Function Description
window
open(maxid, version) opens the MAX application identified by maxid ensuring its version is at minimum version
next() navigates to the next page in the sequence of the list page
previous() navigates to the previous page in the sequence of the list page
reload(online) reloads the current page
alert(text) displays a non blocking text message in the page title
history
back() navigates to the previous page in the history
forward() navigates to the next page in the history
remove() removes the current page from the history
[queryid]
execute() executes the query identified by its id attribute[queryid].
[itemid]
edit() edits the list item identified by its id attribute [itemid]

window.open(maxid, version)

Opens the MAX application identified by the string parameter maxid, which is the id attribute of the <max> element and requires that the MAX application version is version. The version attribute of the currently stored application is checked against the version parameter. If the local application is older than the version parameter, a request to the MAX Application store Web Service is performed to download the latest version. At this time, all local data store created by the MAX application are cleared, to ensure the data structure is the latest one.

The first page of the target max application is displayed.

Note : this function is used internally by the system.home application to start the user's max applications. It is recommended to use the href="max://appid/pageid" attribute of a <item> element to link to other applications.

window.next()

Navigates to the next page in a list. This function enables MAX application developers to allow the user to quickly go to the next detail page in a list. The window.next() performs the actual following steps in the background:

  1. goes back to the previous page,
  2. selects the next item in this list
  3. navigates to this new page.

This function does not add the newly navigated page to the history.
Note: in the case the item was already the last in the list, it simply displays the previous page.
This function is the script equivalent of the nextprevious="true" attribute of a <max> page. It allows to script the functionality such as adding a "Next Item" menu item action in a menu.

window.previous()

Navigates to the previous page in  a list. It is the same behavior as window.next() but in the opposite direction.

window.reload(online)

Reloads the current page.

  • If online parameter is 1, all  queries of type=select in the page are asked to refresh their content from the webservice URL of their datasource, even if the cache is uptodate.
  • If online = 0, no server refresh occurs, even if one or more queries are not up to date.

alert(text)

Displays a non blocking text message by replacing the current title of the current page by the text paramter during 2 seconds.

history.back()

Navigates to the previous page in the history. This function does the same as pressing the Back menu button. It allows programatic access this function.

Note : during a back operation, no HTTP connection is made, even if the queries found in the previous page expired in the cache. It allows quick return to the preivous page.

history.forward()

Navigate to the next page in the history. Same as history.back() but in the opposite direction.

history.remove()

Remove the current page from the history list. It prevents the user to go back to this page when he navigates to another page and then goes back.

[queryid].execute()

Executes the query identified by its id attribute [queryid]. This query must be found in the current page. Must be a update, insert or delete query. If the query is of type=insert, the MAX variable {query.lastrowid} will contain the primary key of the just inserted record.

[itemid].edit()

Edits the list item identified by its id attribute [itemid], found in the current page. It is the script equivalent of clicking on an item of type=select, but this be can applied to any item, even a non visible one.

Note: this function is useful when implementing a New item feature, where you ask first the item name which popups a dialog box by clicking on a regular <item> element