Jam.py documentation

view

view(container)

domain: client

language: javascript

class Item class

Description

Use view method to create a view form of the item.

The method check if the javascript modules of the item and its owner are loaded, and if not (the Dynamic JS modules loading parameter of the project is set) then loads them.

If container parameter (Jquery object of the DOM element) is specified the view form html template is inserted in the container.

If the init_tabs method of the task is called for this conainer the tab is created for this form.

After that it calls the create_view_form method

Example

In the following code the view for of the Tasks journal is created in the on_page_loaded event handler:

function on_page_loaded(task) {

    $("#title").html(task.item_caption);
    if (task.safe_mode) {
        $("#user-info").text(task.user_info.role_name + ' ' + task.user_info.user_name);
        $('#log-out')
        .show()
        .click(function(e) {
            e.preventDefault();
            task.logout();
        });
    }

    task.init_tabs($("#content"));
    task.tasks.view($("#content"));

    $(window).on('resize', function() {
        resize(task);
    });
}