Jam.py documentation

View formΒΆ

We have removed the dynamic menu and call the view method of the “Contacts” journal. This method displays the view form of the journal. Forms in the project are based on html templates, defined in the index.html file in the root folder of the project.

Select task node in the project tree and click the index.html button to open the file.

There is a div with class templates that contains html templates of project forms.

Templates

When an html template is not defined for an item application uses a template of its owner. So for “Contacts” journal the “Journals” group template is used:

Journals template

Let’s make a copy this div and replace journals-view with contacts-view:

Contacts template

This div will now be used as the template of our Contacts journal. We have added the Customers button by inserting the following line in the template:

<button id="customers-btn" class="btn expanded-btn pull-right" type="button"> Customers</button>

Let’s write a code that will be executed when a user clicks this button. To do so we open the “Contacts” journal client module and add the on_view_form_created event handler

on_view_form_created

Let’s refresh the project page and click on the Customers button:

customers_view.png