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
+8-6Lines changed: 8 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -15,15 +15,17 @@ contributors:
15
15
---
16
16
# Grid OnRecordSelect event (Client API reference)
17
17
18
-
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
+
The `OnRecordSelect` event occurs when a single row (record) is selected in the editable grid. This event doesn't occur if a user selects different cells in the same row, or selects multiple rows.
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. The following function will ensure that the record opens using the form specified `pageInput``formId` value.
22
+
When you want to customize the way that a table record opens from the [Power Apps grid control](../../../../../maker/model-driven-apps/the-power-apps-grid-control.md), you can control how this opens with a JavaScript function associated with the grid `OnRecordSelect` event.
23
+
24
+
The following example ensures that the record opens using the form specified `pageInput``formId` value using the [Xrm.Navigation.navigateTo](../Xrm-Navigation/navigateTo.md) method.
23
25
24
26
### Step 1: Create a web resource
25
27
26
-
Create, save and publish a JavaScript (JS) web resource that contains the following code:
28
+
Create, save, and publish a JavaScript (JS) web resource that contains the following code:
27
29
28
30
```JavaScript
29
31
var Example =window.Example|| {};
@@ -51,10 +53,10 @@ Follow these steps to enable the **Power Apps Grid Control** as the main grid (t
51
53
52
54
### Step 3: Register the custom behavior on OnRecordSelect Event
53
55
54
-
When enabling the **Power Apps Grid Control**, an **Events** tab appears. Select the **Events** tab:
56
+
When you enable the **Power Apps Grid Control**, an **Events** tab appears. Select the **Events** tab:
55
57
56
-
1. Under the **Form Libraries** section, add the Form Library from the web resource just created.
57
-
1. Under the **Event Handlers** section, select the event **OnRecordSelect** and click Add, a popup will appear.
58
+
1. Under the **Form Libraries** section, add the Form Library from the web resource created.
59
+
1. Under the **Event Handlers** section, select the event **OnRecordSelect** and select **Add** and a popup appears.
58
60
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**.
59
61
60
62
More information: [Power Apps grid control](../../../../../maker/model-driven-apps/the-power-apps-grid-control.md)
0 commit comments