The Application Builder is disabled. Please remove builder.html from Application folder to enable it!
',
info = item.build_result.split('\n');
for (i = 0; i < info.length; i++) {
color = '#333333';
if (build_problems(item, info[i])) {
color = 'red';
}
html += '' + info[i] + '
';
}
html += '
by Andrew Yushev
' + '2015
', {title: 'Jam.py framework', margin: 0, text_center: true, buttons: {"Yes": undefined, "No": undefined, "Cancel": undefined}, center_buttons: true} ); The result of the code above will be: .. image:: https://jampy-docs-v7.readthedocs.io/en/latest/_images/message_jampy.png :width: 400 :align: center :alt: Message method example ======== question ======== .. js:function:: AbstractItem.question(mess, yes_callback, no_callback, options) :domain: client :language: javascript :class: :js:class:`AbstractItem` Description =========== Creates a modal form with **Yes**, **No** buttons If **yes_callback**, **no_callback** functions are specified they will be executed when user clicks on the **Yes** or **No** button, respectively, and then the form will be closed. Parameters ========== .. list-table:: :header-rows: 1 :widths: 20 15 65 * - Parameter - Type - Description * - ``mess`` - ``string`` - specifies the text or html content that will appear in the body of the form. * - ``yes_callback`` - ``function`` - functions will be executed when user clicks on the **Yes** button. * - ``no_callback`` - ``function`` - functions will be executed when user clicks on the **No** button. * - ``options`` - ``object`` - Example ======= The following code creates a modal form, and delete selected record record when the user clicks the Yes button: .. code-block:: js item.question('Delete record?', function() { item.delete(); } ); The result of the code above will be: .. image:: https://jampy-docs-v7.readthedocs.io/en/latest/_images/delete_jampy.png :align: center :alt: Message delete record ====== server ====== .. js:function:: AbstractItem.server(func_name, params, callback) :domain: client :language: javascript :class: :js:class:`AbstractItem` Description =========== Use ``server`` method to execute a function defined in the server module of an item. ``Server`` method executes a function with a name ``func_name`` defined in the server module of an item with parameters specified in ``params``. .. Attention:: If callback is specified, the function on the server is executed asynchronously, after which the ``callback`` is executed with parameter that is the result of the server function execution, otherwise the function is executed synchronously and returns the result of the server function. If exception was raised during the operation on the server and the callback parameter is not passed (synchronous execution), the client throws an exception. If the callback parameter is present, it is passed to the callback as parameter. When exception is raised during the server function execution, the application on the client throws exception with the server exception text. The first parameter of the function on the server must be ``item``, it must be followed by the parameters specified in the function on the client. Parameters ========== .. list-table:: :header-rows: 1 :widths: 20 15 65 * - Parameter - Type - Description * - ``func_name`` - ``string`` - function with a name ``func_name`` defined in the server module of an item with parameters specified in ``params`` * - ``params`` - ``array`` - list of parameters. Can by optional. **The first parameter of the function on the server must be** ``item`` * - ``callback`` - ``function`` - if specified, the function named ``func_name`` on the server is executed asynchronously, after which the ``callback`` is executed. Example ======= The function defined in the **Invoices** journal ``Server Module``: .. code-block:: py def get_total(item, id_value): result = 0; copy = item.copy() copy.set_where(id=id_value) copy.open() if copy.record_count(): result = copy.total.value else: raise Exception, 'Journal "invoices" does not have a record with id %s' % id_value return result; The following code in the **Invoices** journal ``Client Module`` will execute this server function: .. code-block:: js task.invoices.server('get_total', [17], function(total, err) { if (err) { throw err; } else { console.log(total); } }); ======= warning ======= .. js:function:: AbstractItem.warning(mess, callback) :domain: client :language: javascript :class: :js:class:`AbstractItem` Description =========== Use **warning** to create a modal form with the **Ok** button. Parameters ========== .. list-table:: :header-rows: 1 :widths: 20 15 65 * - Parameter - Type - Description * - ``mess`` - ``string`` - Specifies the text or html content that will appear in the body of the form. * - ``callback`` - ``function`` - If is specified it will be executed when user clicks the button and then the form will be closed. Example ======= .. code-block:: js item.warning('No record selected.'); ============= yes_no_cancel ============= .. js:function:: AbstractItem.yes_no_cancel(mess, yes_callback, no_callback, cancel_callback) :domain: client :language: javascript :class: :js:class:`AbstractItem` Description =========== Use **yes_no_cancel** to create a modal form with **Yes** **No**, **Cancel** buttons. Parameters ========== .. list-table:: :header-rows: 1 :widths: 20 15 65 * - Parameter - Type - Description * - ``mess`` - ``string`` - Specifies the text or html content that will appear in the body of the form. * - ``yes_callback`` - ``function`` - Function are specified they will be executed when user clicks on the **Yes** button. * - ``no_callback`` - ``function`` - Function are specified they will be executed when user clicks on the **No** button. * - ``cancel_callback`` - ``function`` - Function are specified they will be executed when user clicks on the **Cancel** button. Example ======= The following code is executed when user clicks on the close button in the upper right corner of an item edit form. .. code-block:: js function on_edit_form_close_query(item) { var result = true; if (item.is_changing()) { if (item.is_modified()) { item.yes_no_cancel('Data has been modified. Save changes?', function() { item.apply_record(); }, function() { item.cancel_edit(); } ); result = false; } else { item.cancel(); } } return result; } The result of the code above will be: .. image:: https://jampy-docs-v7.readthedocs.io/en/latest/_images/yes_no_cancel_jampy.png :align: center :alt: Message Yes, No, Cancel ========== Task class ========== .. js:class:: Task :domain: client :language: javascript Task class is used to create the root of the :doc:`Task tree ` of the project. Below the attributes, methods and events of the class are listed. It, as well, inherits attributes and methods of its ancestor class :js:class:`AbstractItem` Attributes ========== .. toctree:: :maxdepth: 1 :glob: task/at_* Methods ======= .. toctree:: :maxdepth: 1 :glob: task/m_* Events ====== .. toctree:: :maxdepth: 1 :glob: task/on_* =============== forms_container =============== .. js:attribute:: forms_container **domain**: client **language**: javascript **class** :doc:`Task ` Description =========== The ``forms_container`` is a JQuery object in which the application will create forms. To initialize ``forms_container`` use the :doc:`set_forms_container