Skip to main content

Function: MnOnGridRecordSelect

MnOnGridRecordSelect(controlName): (target: any, key: any, descriptor: PropertyDescriptor) => void

Decorator that marks a method as an event handler for grid record select event.

This event is fired when one grid row is selected in a editable grid. It is not fired when the users select multiple rows.

Remarks

Available on pages: Record only.

Registration: Manual registration only. Register onGridRecordSelect with the name of the grid control as first additional parameter.

For more information, see Microsoft Client API Reference

Example

Show the phone number of the selected contact in a sub-grid of an account form

@MnComponent({
scope: {
pageType: "record",
table: "account"
}
})
export class MyComponent {
@MnOnGridRecordSelect("subgrid_contacts")
onGridRecordSelect(eventArg: FormEventArg) {
const telephoneAttr = eventArg.formCtx.data.entity.attributes.get("telephone1");
const telephone = telephoneAttr.getValue();
Xrm.Navigation.openAlertDialog({ text: `Selected telephone number: ${telephone}` });
}
}

Parameters

NameTypeDescription
controlNameValueOrConfigPropertyMapper<string>Name of the grid control or callback function that returns the name of the grid control from the component configuration.

Returns

fn

▸ (target, key, descriptor): void

Parameters
NameType
targetany
keyany
descriptorPropertyDescriptor
Returns

void

Defined in

packages/core/src/core/metadata/events.ts:332