This module provides various utility methods which helps to work with Page objects.
- Version:
- 16.3.5
- Source:
- See:
-
- Page object which is being essential parameter for utility methods
- Pages module which helps to obtain particular page by ID
- Navigation module which help to obtain active page
Methods
(static) findPagesOfType(pageType, entityIdopt) → {Array.<pages.dt/js/api/Page>}
stable API
Finds all pages of the given PageType and created for the given entity.
The examined entity doesn't need to be provided. In that case the method returns all pages of the particular PageType.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pageType |
pages.dt/js/api/PageType | page type |
|
entityId |
String |
<optional> |
entity ID |
- Version:
- 16.3.5
- Source:
- See:
-
- PageType list of possible page types
- Entities.getAll list of all available entities within the application
Returns:
list of all pages of the given type and related to the entity ID
- Type
- Array.<pages.dt/js/api/Page>
Example
var result = [];
// lists all requested page types
var pageTypes = [PageType.EDIT, PageType.CRAETE, PageType.DETAIL];
// iterates over all page types and gathers them into the result
pageTypes.forEach(function(pageType) {
result = result.concat(PageUtils.findPagesOfType(pageType, 'myEntity'));
});
(static) findViewsByType(page, viewType) → {Array.<pages.dt/js/api/View>}
stable API
Finds all Views on the page with the given view type.
Iterates through all views on the page starting at the top level page's view and collects all that have view type given by the parameter.
Parameters:
Name | Type | Description |
---|---|---|
page |
pages.dt/js/api/Page | to seek for views |
viewType |
String | type of the searched view |
- Version:
- 16.3.5
- Source:
- See:
-
- View for description how the view objects are structured
Returns:
list of found views of the given type
- Type
- Array.<pages.dt/js/api/View>
Example
// will yield active page
var page = Navigation.getActivePage();
// recursively finds all custom types on the page
var views = PageUtils.findViewsByType(page, 'org.company.abcs.components.coolButton');
(static) getPageArchetypes(page) → {Array.<viewmodel/js/api/Archetype>}
stable API
Gathers and gets all archetypes available on the given page.
Parameters:
Name | Type | Description |
---|---|---|
page |
pages.dt/js/api/Page | page where to seek archetypes |
- Version:
- 16.3.5
- Source:
- See:
-
- Pages module which helps to obtain particular page by ID
- Navigation module which help to obtain active page
Returns:
list of all archetype objects used on the given page
- Type
- Array.<viewmodel/js/api/Archetype>
Example
// gets the active page
var activePage = Navigation.getActivePage();
// gets all available archetypes
var archetypes = PageUtils.getPageArchetypes(activePage);
// gathers entities from the archetypes
var entityIDs = [];
archetypes.forEach(function(archetype) {
entityIDs.push(archetype.getEntity())
});