Jam.py documentation

Working with modulesΒΆ

For every item of the project task tree a developer can write code that will be executed on the client or server. In Application builder for every item there is two upper-right buttons Client module and Server module. Clicking on these will open the code editor.

Every item has a predefined set of events that could be triggered by application. An event is a function defined in the module of an item that starts with the on_ prefix. All published events are listed in the Events tab of the information pane of the code editor

In the code editor the developer can write code for these events as well as define some functions.

For example the following code means that immediately after adding a new record to the Invoices journal of the Demo project, the value of the invoicedate field will be equal to the current date.

function on_after_append(item) {
    item.invoicedate.value = new Date();
}

Note

These events and functions became attributes of the item and could be accessed anywhere in the project code.

For example, the following code defined in the item client module will execute on_edit_form_created event handler defined in the Customers item for this item.

function on_edit_form_created(item) {
    task.customers.on_edit_form_created(item);
}