Jam.py documentation

Initializing applicationΒΆ

The on_page_loaded event is the first event triggered by an application on the client.

Write this event handler to initialize the application.

The Demo project uses on_page_loaded event handler to dynamically build the application’s main menu and attach the on click event handler to menu items using JQuery.

Let’s look at CRM application on_page_loaded event handler:

function on_page_loaded(task) {

    if (task.safe_mode) {
        $("#user-info").text(task.user_info.role_name + ' ' + task.user_info.user_name);
        .click(function(e) {


In this event handler, the application, first, sets the text of the div with id=”title” to the value of the item_caption attribute of the task.

After that, if the project is in the safe mode , displays the user info and uses JQuery to assign onclick event to the a tag, decleared in the tndex.html file , to logout when user clicks it.

Then it calls the view method of the Contacts item to show the contacts in the div with id=”content”. See Forms.