Last active
March 27, 2020 00:34
-
-
Save andrew-grischenko/f0268ecbd957586e5988b85373379132 to your computer and use it in GitHub Desktop.
Power Apps PCF - On events handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
const STATUS_NEW: string = "new"; | |
const STATUS_ERROR: string = "error"; | |
const STATUS_PROCESSING: string = "processing"; | |
const STATUS_COMPLETED: string = "completed"; | |
export class Payments implements ComponentFramework.StandardControl<IInputs, IOutputs> { | |
... | |
private transaction_status: string; | |
private _notifyOutputChanged: () => void; | |
... | |
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container:HTMLDivElement) | |
{ | |
... | |
this.transaction_status = STATUS_NEW; | |
this._notifyOutputChanged = notifyOutputChanged; | |
... | |
} | |
public getOutputs(): IOutputs | |
{ | |
//This is where we set the value on changes happened | |
return { PaymentStatus: this.transaction_status }; | |
} | |
private processPayment( ) | |
{ | |
... | |
this.transaction_status = STATUS_COMPLETED; | |
this._notifyOutputChanged(); | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<manifest> | |
<control...> | |
<property name="TransactionStatus" display-name-key="TransactionStatus" description-key="Transaction status" of-type="SingleLine.Text" usage="bound" required="true" default-value="new"/> | |
... | |
</control> | |
</manifest> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OnChange: | |
If(PaymentWidget.TransactionStatus = "completed", Navigate(ReceiptScreen)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment