Page¶
A page acts as a container for the controls that the user interacts.
Figure 1 - Page with a Selector, a List, and a Group
Variations¶
None
When to use¶
A page is required for content to be placed in the main area.
Limitations¶
None
How to use¶
1. Define a Page¶
Define a page as shown below. A page is usually connected to a datasource, however page can also exist without a datasource. In such instances the datasource comes from a control such as a list.
// Page Definition 1 - Without a datasource
// ----------------------------------------
page <page_name> {
...//Page properties
...//Page content
}
// Page Definition 2 - With a datasource
// -------------------------------------
page <page_name> using <entity_set>{
...//Page properties
...//Page content
}
// Example Code - Page without a datasource
// ----------------------------------------
page CustOrdOverview {
label = "Customer Orders";
list CustOrdList using CustomerOrders;
}
// Example Code - Page with a datasource
// -------------------------------------
page Form using ShopFloorEmployees {
label = "Shop Floor Employees";
... // Page content
}
2. Set properties and add page content¶
Customize the available page properties and add page content such as client controls.
3. Setting the initcontext¶
A page can contain an initcontext
. An initcontext
has two uses:
- Define page parameters provided on the URL that are available on the whole page.
- Execute an
init
command that runs every time the URL is changed for the page.
The initcontext
can be defined separately and then declare on the page that it should be used. When it comes to accessing parameters, within the initcontext
definition you access the parameters directly without any prefixing, in all other places on the page and components you need to use the prefix initcontext
to access the parameters. See example example 2 for how to work with the initcontext
. |||
4. Add additional features¶
You can add the following optional features to make the page more functional and visually appealing.
Enable Attachments¶
This feature is enabled by the means of a Struct
called attachments
:
attachments {
enabled = [true];
}
Enable detection of idle time on a page¶
There maybe instances where a command must be executed if a user is inactive on a page for a certain time. Inactive on a page means if the user has not clicked, typed, or scrolled the page for the given time. The time is given in milliseconds, see example code below where a page is set up to execute a command when the page is idle for ten minutes.
page MyPage using orders{
label = "Internal Orders";
idletimer 600000 command TestCommandRun;
list CustomerOrderList;
}
Add a Search Context¶
Search context is a feature used to store certain non-entity parameters in the page and use them primarily to filter data displayed on the page. For detailed information on how to add a search context, refer the associated technical documentation.
Add a State Indicator¶
Make the page more visually appealing by including a state indicator to display the state of the selected record of a page. For detailed information on how to add a state indicator, refer the associated technical documentation.
Keywords¶
using
Properties¶
Below is a list of properties that can be used to customize the page.
defaultfilter | defaultsearchfields | editmode | label | pinnedsearchfields | requiredsearchfields | startupmode | staticlabel
Example¶
Example 1 - Page with two lists¶
Below is an example of a basic page containing two lists.
page Form using ShopFloorEmployees {
label = "Shop Floor Employees";
list TblShopFloorEmployee;
list TblShopFloorEmployeeSite(ShopFloorEmployeeSiteArray) bind TblShopFloorEmployee {
display = Nested;
collapsed = [true];
}
}
Example 1 - Definition for a page containing two lists
Example 2 - Page with initcontext¶
Below is an example of a page using the initcontext
.
page TestPage using TestSet {
initcontext Test;
selector TestSelector;
group MainGroup;
command TestCommand;
}
initcontext Test {
parameter Company Text;
parameter Offset Number;
init command {
execute {
if [Company != null and Offset != null] {
call DoAction(Offset, Company);
info("Company: ${Company}, Offset: ${Offset}");
}
}
}
}
command TestCommand for Test {
label = "Test initcontext";
enabled = [initcontext.Company = "10" and initcontext.Offset > 1000];
execute {
if [initcontext.Company != null and initcontext.Offset != null] {
set VarCompany = initcontext.Company;
call DoAction(initcontext.Offset, initcontext.Company);
info("Company = ${initcontext.Company}, Offset = ${initcontext.Offset}");
}
}
}
Example 2 - Page with initcontext