Jam.py documentation

How was Demo-Invoices view initialised?ΒΆ

How can I initialise a default page? For example, how was Demo->Invoices view initialised as a default page?

There is on_page_loaded event handler in the task client module. It is triggered immediately after the index.html file is downloaded and the task tree is initialized. It creates dynamic menu and then imitates clicking on menu buttons:

$('#menu .item-menu:first').click();

But there is a more simple way. You can use the view method of an item. It create a view form of an item based on its html template.

For example, execute the following in the browser console to view customers data in the demo application:

task.customers.view($("#content"))

or

task.customers.view()

to view it in a modal form.

So replace the code imitating clicking on menu buttons in the default code with

task.customer.view($("#content"))

to display Customers data when the application starts.