Skip to main content

Function: MnOnGridSave

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

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

This event is fired when a grid control is saved.

Remarks

Available on pages: Record only.

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

For more information, see Microsoft Client API Reference

Example

Show columns changed in a contact sub-grid of an account record

@MnComponent({
scope: {
pageType: "record",
table: "account"
}
})
export class ShowChangedColumnComponent {
@MnOnGridSave("subgrid_contacts")
onGridLoad(eventArg: FormEventArg) {
const attributesChanged = eventArg.formCtx.data.entity.attributes.get()
.filter(attr => attr.getIsDirty())
.map(attr => attr.getName());

eventArg.formCtx.ui.setFormNotification(`Grid saved. Columns changed: ${attributesChanged.join(", ")}`, "INFO", "gridSaved");
}
}

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