Editar

Partilhar via


Page module

Important

The finance and operations (Dynamics 365) mobile app and platform are no longer supported. The platform components supporting the mobile app will be removed in a future update. The mobile app has also been removed from app stores. Previously installed instances of the app will continue to work. For more information, see Removed or deprecated platform features.

The IPage interface encapsulates the various properties, life cycle and event hooks associated with a page in a workspace.

Page data Synchronization

Pages that can submit changes (also referred to as actions) go through various stages before they're completely in sync with the server. As soon as a page is submitted, there are three possible consequences:

  • It fails client-side validation: The client logic might prevent the page from being submitted.
  • The client is online: The submission is processed as soon as the application-wide sync queue is cleared.
  • The client is offline: The submission is added to the application-wide sync queue and stays there as long as the client is offline.

While a submission is waiting to be synchronized, it can be in one of these states:

  • Pending: The submission is still pending and can still be edited.
  • Processing: The submission is currently being synchronized. In this state, any further edits are not allowed on the page.

After a submission goes through to the server, it can be in one of these states:

  • Synchronized: The submission is accepted by the server and is synchronized.
  • Error: The server rejects the submission and the page enters an error state.

Multiple pending submissions for a given page and context might be clubbed (and sent) together if the page is deemed to be idempotent. This implies that the server need not process all submissions in any order and depends on the design of the page on the server.

Index

Enumerations

Types

Enumerations

PageState

Enumeration members

Name Signature Description
error error:
10
The page is currently in the error state, but can be refreshed in an attempt to get out of this state.
loaded loaded:
3
The page is fully loaded and can be refreshed and, if possible, submitted.
loading loading:
2
The page is currently being loaded.
offline offline:
1
The page was loaded in the offline mode, thus not refreshable.
refreshing refreshing:
4
The page is currently refreshing its data.

Types

CompleteEventArgs

Hierarchy

CompleteEventArgs

Properties

Name Signature Description
error error: boolean (optional)
navigation navigation: NavigationArgs (optional)
processed processed: boolean (optional)

Design

Hierarchy

Design
   └─ PageLinkDesign
   └─ ContainerControlDesign
   └─ InputControlDesign
   └─ ImageDesign

Properties

Name Signature Description
alignItems alignItems: string (optional)
This property is an alias for the CSS property "align-items".
alignSelf alignSelf: string (optional)
bindings bindings: any (optional)
border border: "none" | "solid" | "left" | "right" | "top" | "bottom" (optional)
The border behavior of a control. This property will not be inherited by the children.
color color: string (optional)
The foreground color of the container.
flexFlow flexFlow: string (optional)
Specifying this property makes the component a flex container component.
flexSize flexSize: string (optional)
One number or two numbers written as a string. For example, "(size to grow) [(size-to-shrink)]" to accommodate available space in the immediate flex container.
fontSize fontSize: "medium" | "xx-small" | "x-small" | "small" | "large" | "x-large" | "xx-large" (optional)
The proportional text size
fontWeight fontWeight: "normal" | "bold" (optional)
Normal or bold text.
justifyItems justifyItems: "flex-start" | "flex-end" | "center" | "space-between" (optional)
This property is an alias for the CSS property "justify-content".
label label: string (optional)
labelPosition labelPosition: "stacked" | "hidden" | "inline" (optional)
Determines how a label is positioned, if at all. By default, labelPosition is set to stacked.
name name: string (optional)
padding padding: "none" | "small" | "std" (optional)
Allows specifying the component's padding behavior.
type type: ControlType (optional)
The type of the control as a string.

Hierarchy

PageTarget
   └─ NavigationArgs

Properties

Name Signature Description
label label: string (optional)
options options: any (optional)
params params: PageOptions (optional)
Inherited from PageTarget.params
replace replace: boolean (optional)
If set to true, removes current view firing navigation from navigation history stack.
to to: string (optional)
Inherited from PageTarget.to
url url: string (optional)
If provided, this link is directly opened.

Page

Hierarchy

Page

Properties

Name Signature Description
children children: Control [ ]
The list of all direct children controls of the page.
dataLoadedInitially dataLoadedInitially: Promise <void>
A promise which resolves when the data has loaded for the first time.
initialized initialized: boolean
True if the page instance has been initialized.
metadata metadata: PageMetadata
The page metadata.
metadataLoaded metadataLoaded: Promise <void>
A promise which resolves when the metadata has finished loading.
pageContext pageContext: string
The current page context.
pageFilter pageFilter: DataFilter
The current filter applied on the page.
state state: PageState
The current state of the page.
syncError syncError: boolean
True if the page's submission is in error state. This normally happens when the server rejects submissions due to validation errors.
syncPending syncPending: boolean
True if the page's submission is waiting to be synced.
syncProcessing syncProcessing: boolean
True if the page instance is currently syncing its submission.
syncUnitEditable syncUnitEditable: boolean
True if it's possible to edit a submission while it's waiting to be synchronized.
title title: string
The title of the page.

Methods

Name Signature Description
canSubmit canSubmit(): boolean Returns true if action page can be submitted and there are no validation error messages.
close close(): void Dispose the page instance and all its lifecycle events.
getAction getAction(actionName: string): PageLink Get a page action by name.
getActions getActions(): PageLink [ ] Get all page actions.
getControl getControl(controlName: string): Control Get a page control by name.
getDesign getDesign(): Design Get the design object associated with the page.
getEntityContext getEntityContext(): EntityRef Get current entity context.
isEditable isEditable(): boolean Returns true if the page is an Action Page
refreshData refreshData(): Promise <void> Force refresh page data.
resume resume(): Promise <void> Resume a temporarily suspended page.
submit submit(): Promise <CompleteEventArgs> Submit an Action.
suspend suspend(): void Temporarily suspend a page.

Events

Name Signature Description
onClose onClose: EventHook <null>
Event that is raised when a page is closed.
onComplete onComplete: EventHook <any>
Event that is raised when an action is completed.
onDataLoaded onDataLoaded: EventHook <any>
Event that fires when the page data has loaded.
onInit onInit: EventHook <any>
Event that fires when a page instance has been initialized, and the metadata has been loaded.
onPreInit onPreInit: EventHook <any>
Event that fires when a page instance has been initialized.
onRefresh onRefresh: EventHook <null>
Event that fires on forced page refresh, before new data has been loaded.
onStateChange onStateChange: EventHook <null>
Event that fires when the page state changes.
onSubmit onSubmit: EventHook <PageSubmitArgs>
Event that fires before an action is submitted. It can be intercepted for action validation deferring
onSyncStatusChange onSyncStatusChange: EventHook <null>
Event that fires when the page sync status changes.

PageMetadata

Hierarchy

PageMetadata

Properties

Name Signature Description
Controls Controls: ControlMetadata [ ] (optional)
Design Design: Design (optional)
Id Id: string (optional)
QuickSubmit QuickSubmit: boolean (optional)
SourcePageId SourcePageId: string (optional)
SubmitButtonDesign SubmitButtonDesign: Design (optional)
Tasks Tasks: PageMetadata [ ] (optional)
Title Title: string (optional)

Events

Name Signature Description
OnDataLoaded OnDataLoaded: function(sender: Page, dataWrapper: any): void (optional)
OnInit OnInit: function(sender: Page): void (optional)
OnPreInit OnPreInit: function(sender: Page): void (optional)
OnSubmit OnSubmit: function(dataValues: any, args: any): void (optional)
OnTaskSubmitted OnTaskSubmitted: function(taskHandle: any, taskOptions: any): any (optional)
OnTaskSubmitting OnTaskSubmitting: function(taskOptions: any): any (optional)

PageOptions

Hierarchy

PageOptions

Properties

Name Signature Description
appId appId: string (optional)
design design: Design (optional)
excludeContext excludeContext: boolean (optional)
filter filter: DataFilter (optional)
filterLocalOnly filterLocalOnly: boolean (optional)
pageContext pageContext: string (optional)
pageId pageId: string (optional)
readOptions readOptions: IReadOptions (optional)

PageSubmitArgs

Hierarchy

PageSubmitArgs

Properties

Name Signature Description
dataValues dataValues: any
Get the payload of the submit action.
sender sender: Page
Get the sender page instance of the submit action.

Methods

Name Signature Description
addMessage addMessage(message: string, type: any): any Add a validation error message to be displayed.
cancel cancel(): any Prevent the action from submitting.
getMessages getMessages(): string [ ] Get all previously added messages
isCancelled isCancelled(): boolean Check if the submit action is cancelled.
wait wait(promise: Promise <any>): any Wait on a given promise before continuing with the submission.

PageTarget

Hierarchy

PageTarget
   └─ NavigationArgs

Properties

Name Signature Description
params params: PageOptions (optional)
to to: string (optional)