Jam.py documentation

create_param_inputs

create_param_inputs(container, options)

domain: client

language: javascript

Description

Use create_param_inputs to create data-aware visual controls (inputs, cheboxes) for editing of report parameters.

This method is usually used in on_param_form_created events triggered by create_param_form method, that, usually, is called by then print method.

The following parameters are passed to the method:

  • container - a JQuery object that will contain visual controls, if container length is 0 (no container), the method returns.

  • options - options that specify how controls are displayed

The options parameter is an object that may have following attributes:

  • params - a list of param names. If specified, a visual control will be created for each param whose name is in this list, if not specified (the default) then control will be created for all visible params specified in the Application builder

  • col_count - the number of columns that will be created for visual controls, the default value is 1

  • label_on_top: the default value is false. If this value is false, the labels are placed to the left of controls, otherwise the are created above the controls

  • tabindex - if tabindex is specified, it will the tabindex of the first visual control, tabindex of all subsequent controls will be increased by 1.

  • autocomplete - the default value is false. If this attribute is set to true, the autocomplete attribute of controls is set to “on”

Before creating controls the application empties the container.

Example

function on_param_form_created(item) {
    item.create_param_inputs(item.param_form.find(".edit-body"));
    item.param_form.find("#cancel-btn").on('click.task', function() {
        item.close_param_form()
    });
    item.param_form.find("#ok-btn").on('click.task', function() {
        item.process_report()
    });
}