Skip to main content

Function: MnOnGridChange

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

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

This event is fired when a cell in an editable grid control is changed.

Remarks

Available on pages: Record only.

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

For more information, see Microsoft Client API Reference

Example

Show the changed cell in a contact sub-grid of an account form

@MnComponent({
scope: {
pageType: "record",
table: "account"
}
})
export class ShowChangedCellComponent {
@MnOnGridChange("subgrid_contacts")
onGridChange(eventArg: FormEventArg) {
const cellChanged = eventArg.formCtx.data.entity.attributes.get()
.find(attr => attr.getIsDirty());

eventArg.formCtx.ui.setFormNotification(`Cell value changed. Column changed: ${cellChanged?.getName()}`, "INFO", "gridChanged");
}
}

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:370