Skip to content

Commit 81f74a2

Browse files
committed
tidy up
1 parent 1ac26b5 commit 81f74a2

File tree

1 file changed

+46
-34
lines changed

1 file changed

+46
-34
lines changed

powerapps-docs/developer/component-framework/sample-controls/object-output.md

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Object Output Component Sample| Microsoft Docs"
33
description: "Learn how you can use the object outout APIs."
44
ms.author: noazarur
55
author: noazarur-microsoft
6-
ms.date: 11/07/2022
6+
ms.date: 06/07/2023
77
ms.reviewer: jdaly
88
ms.topic: reference
99
ms.subservice: pcf
@@ -23,7 +23,7 @@ Model-driven apps and Canvas apps
2323

2424
## Prerequisites
2525

26-
Familarity [creating code components](../implementing-controls-using-typescript.md).
26+
Familiarity [creating code components](../implementing-controls-using-typescript.md).
2727

2828
## Code
2929

@@ -34,56 +34,68 @@ We also need to create a property dependency between these two properties.
3434

3535
```typescript
3636
<!-- A hidden property used by Canvas to get the output object schema -->
37-
<property name="DataSchema" display-name-key="DataSchema" description-key="DataSchema" of-type="SingleLine.Text" usage="input" hidden="true"/>
38-
<!-- The object type output property -->
39-
<property name="Data" display-name-key="Data" description-key="Data" of-type="Object" usage="output" hidden="false" default-value=""/>
40-
41-
<property-dependencies>
42-
<!-- Define the dependency between schema and the object type property -->
43-
<property-dependency input="DataSchema" output="Data" required-for="schema" />
44-
</property-dependencies>
45-
37+
<property name="DataSchema"
38+
display-name-key="DataSchema"
39+
description-key="DataSchema"
40+
of-type="SingleLine.Text"
41+
usage="input"
42+
hidden="true" />
43+
<!-- The object type output property -->
44+
<property name="Data"
45+
display-name-key="Data"
46+
description-key="Data"
47+
of-type="Object"
48+
usage="output"
49+
hidden="false"
50+
default-value="" />
51+
<property-dependencies>
52+
<!-- Define the dependency between schema and the object type property -->
53+
<property-dependency input="DataSchema"
54+
output="Data"
55+
required-for="schema" />
56+
</property-dependencies>
4657
```
4758

48-
In the index.ts file we need to add [getOutputSchema](../reference/control/getoutputschema.md) method to provide the output object schema. When the control is added to a Canvas App, the platform will call to this method prior to control initialization to receive the output object(s) schema(s).
59+
In the index.ts file we need to add [getOutputSchema](../reference/control/getoutputschema.md) method to provide the output object schema. When the control is added to a Canvas App, the platform will call to this method prior to control initialization to receive the output object(s) schema(s).
4960

5061
```typescript
51-
public async getOutputSchema(context: ComponentFramework.Context<IInputs>): Promise<Record<string, unknown>> {
52-
return Promise.resolve({
53-
Data: StaticDataSchema
54-
});
55-
}
56-
62+
public async getOutputSchema(context: ComponentFramework.Context<IInputs>): Promise<Record<string, unknown>> {
63+
return Promise.resolve({
64+
Data: StaticDataSchema
65+
});
66+
}
5767
```
5868

5969
Update the `getOutput` method to return value for the output property.
6070

6171
```typescript
62-
public getOutputs(): IOutputs {
63-
return {
64-
Data: this._staticData
65-
};
66-
}
67-
72+
public getOutputs(): IOutputs {
73+
return {
74+
Data: this._staticData
75+
};
76+
}
6877
```
6978

7079
The `onLoadData` method will be called when the **Load Data** button is pressed to load the data to the output object and notify the platform about the output changes. This will trigger onChange behavior in the Canvas App for the control or [OnOutputChange](../../model-driven-apps/clientapi/reference/events/onoutputchange.md) event for client APIs.
7180

7281
```typescript
73-
private onLoadData = async () => {
74-
this._staticData = StaticData;
75-
this._staticData.loadCounter = (this._staticData.loadCounter || 0) + 1;
76-
this.notifyOutputChanged();
77-
}
78-
82+
private onLoadData = async () => {
83+
this._staticData = StaticData;
84+
this._staticData.loadCounter = (this._staticData.loadCounter || 0) + 1;
85+
this.notifyOutputChanged();
86+
}
7987
```
8088

8189
### Related topics
8290

83-
[onOutputChange Event](../../model-driven-apps/clientapi/reference/events/onoutputchange.md)<br />
84-
[StandardControl.getOutputSchema](../reference/control/getoutputschema.md)<br />
85-
[ReactControl.getOutputSchema](../reference/react-control/getoutputschema.md)<br />
86-
[StandardControl.getOutputs](../reference/control/getoutputs.md)<br />
91+
[onOutputChange Event](../../model-driven-apps/clientapi/reference/events/onoutputchange.md)
92+
93+
[StandardControl.getOutputSchema](../reference/control/getoutputschema.md)
94+
95+
[ReactControl.getOutputSchema](../reference/react-control/getoutputschema.md)
96+
97+
[StandardControl.getOutputs](../reference/control/getoutputs.md)
98+
8799
[ReactControl.getOutputs](../reference/react-control/getOutputs.md)
88100

89101
[!INCLUDE[footer-include](../../../includes/footer-banner.md)]

0 commit comments

Comments
 (0)