Jam.py documentation

on_field_get_html

on_field_get_html(field)

domain: client

language: javascript

class Item class

Description

Write an on_field_get_html event handler to specify the html that will be inserted in the table cell for the field.

If the event handler does not return a value, the application checks if the on_field_get_text event handler is defined and it returns a value, otherwise the display_text property value will be used to display the field value in the cell.

The field parameter is the field whose display_text is processed. To get the item that owns the field, use the owner attribute of the field.

Example

function on_field_get_html(field) {
    if (field.field_name === 'total') {
        if (field.value > 10) {
            return '<strong>' + field.display_text + '</strong>';
        }
    }
}