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
+11-8Lines changed: 11 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -19,21 +19,25 @@ The `OnRecordSelect` event occurs when a single row (record) is selected in the
19
19
20
20
## Example: Override the default open behavior in model-driven grids
21
21
22
-
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 achieve this using the [Power Apps grid control](../../../../../maker/model-driven-apps/the-power-apps-grid-control.md) and the `OnRecordSelect` event.
22
+
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 achieve this using the [Power Apps grid control](../../../../../maker/model-driven-apps/the-power-apps-grid-control.md) and the `OnRecordSelect` event. The following function will ensure that the record opens using the form specified `pageInput``formId` value.
23
23
24
24
### Step 1: Create a web resource
25
25
26
26
Create, save and publish a JavaScript (JS) web resource that contains the following code:
More information: [Create or edit model-driven app web resources](../../../../../maker/model-driven-apps/create-edit-web-resources.md)
@@ -50,9 +54,8 @@ Follow these steps to enable the **Power Apps Grid Control** as the main grid (t
50
54
When enabling the **Power Apps Grid Control**, an **Events** tab appears. Select the **Events** tab:
51
55
52
56
1. Under the **Form Libraries** section, add the Form Library from the web resource just created.
53
-
1. Under the **Event Handlers** section, select the event **OnRecordSelect** and click **Add**, a popup will appear.
54
-
1. 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.
55
-
57
+
1. Under the **Event Handlers** section, select the event **OnRecordSelect** and click Add, a popup will appear.
58
+
1. In the popup, select the form library just added and the function name `Example.OnSelect`. This is the name of the JavaScript function created in the web resource. Make sure to check the option **Pass execution context as first parameter**.
56
59
57
60
More information: [Power Apps grid control](../../../../../maker/model-driven-apps/the-power-apps-grid-control.md)
0 commit comments