You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/developer/model-driven-apps/clientapi/reference/events/grid-onrecordselect.md
+15-14Lines changed: 15 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ contributors:
17
17
The `OnRecordSelect` event occurs when a single row (record) is selected in the editable grid. This event won't occur if a user selects different cells in the same row, or selects multiple rows.
18
18
19
19
## Override the default open behavior in model-driven grids
20
-
There might be situations where you don't want the table record to open (which is the default behavior), but want a custom action to be performed such as opening a URL using JavaScript functions. Here is an example to acheive this using the [Power Apps Grid Control](/power-apps/maker/model-driven-apps/the-power-apps-grid-control) and the `OnRecordSelect` event.
20
+
There might be situations where you don't want the table record to open (which is the default behavior), but want a custom action to be performed such as opening a URL using JavaScript functions. Here is an example to acheive this using the [Power Apps Grid Control](../../../../../maker/model-driven-apps/the-power-apps-grid-control) and the `OnRecordSelect` event.
21
21
22
22
### Step 1: Create a web resource
23
23
@@ -40,32 +40,33 @@ Create a web resource to change the default behavior. In the following example,
40
40
41
41
5. Enter the name of the web resource, and select the **Type** as **JavaScript (JS)**.
42
42
43
-
6. Select **Text Editor**, copy the code shown below, paste it into the text editor, and enter the value of the URL you want to open:
43
+
6. Select **Text Editor**, copy the code shown below, paste it into the text editor. This example uses the **contact** table. Set the `entityName` to the table you want.
Follow these steps to enable the **Power Apps Grid Control** as the main grid (table view) or within a model-driven form subgrid:
58
-
-[Use as main grid](/power-apps/maker/model-driven-apps/the-power-apps-grid-control#add-the-power-apps-grid-control-to-views-for-an-entity)
59
-
-[Use as subgrid](/power-apps/maker/model-driven-apps/the-power-apps-grid-control#add-the-power-apps-grid-control-to-a-subgrid)
58
+
Follow these steps to enable the **Power Apps Grid Control** as the main grid (table view) or within a model-driven form subgrid.
59
+
-[Use as main grid](../../../../../maker/model-driven-apps/the-power-apps-grid-control#add-the-power-apps-grid-control-to-views-for-an-entity)
60
+
-[Use as subgrid](../../../../../maker/model-driven-apps/the-power-apps-grid-control#add-the-power-apps-grid-control-to-a-subgrid)
60
61
61
62
62
63
### Step 3: Register the custom behavior on OnRecordSelect Event
63
64
When enabling the **Power Apps Grid Control**, an **Events** tab appears. Select the **Events** tab:
64
65
1. Under the **Form Libraries** section, add the Form Libary from the web resource just created.
65
66
2. Under the **Event Handlers** section, select the event **OnRecordSelect** and click Add, a popup will appear.
66
-
3. In the popup, select the form library just added and the Function name **ChangeBehavior**. This is the name of the JavaScript function created in the web resource.
67
+
3. In the popup, select the form library just added and the Function name **OnSelect**. This is the name of the JavaScript function created in the web resource, and check the option **Pass execution context as first parameter**.
67
68
68
69
69
-
For more infomation, see [Power Apps Grid Control](../../../../power-apps/maker/model-driven-apps/the-power-apps-grid-control)
70
+
For more infomation, see [Power Apps Grid Control](../../../../../maker/model-driven-apps/the-power-apps-grid-control)
0 commit comments