ASPxClientEdit.AttachEditorModificationListener(handler, predicate) Method

Attaches a handler to the ASPxClientEdit's event indicating whether the editor has been changed since the previous state.

Declaration

static AttachEditorModificationListener(handler: any, predicate: ASPxClientControlPredicate): void

Parameters

Name Type Description
handler any

An object representing a handler.

predicate ASPxClientControlPredicate

An ASPxClientControlPredicate object representing the predicate criteria.

Remarks

Use the AttachEditorModificationListener method to attach a handler to the ASPxClientEdit's event, indicating whether the editor's value has been changed since the previous state. The following editor's changes are considered by the AttachEditorModificationListener method:

Editor Event
ASPxClientEdit ASPxClientEdit.ValueChanged
ASPxClientListEdit ASPxClientListEdit.SelectedIndexChanged
ASPxClientTextEdit ASPxClientTextEdit.UserInput

To detach the handler from the editor's event if the editor meets the predicate criteria, use the ASPxClientEdit.DetachEditorModificationListener method.


function onControlsInitialized() {
    ASPxClientEdit.AttachEditorModificationListener(onEditorsChanged, function(control) {
            return control.GetParentControl() === FormLayout // Gets standalone editors nested inside the form layout control
    });
    ASPxClientUtils.AttachEventToElement(window, "beforeunload", onBeforeUnload);
    state = ASPxClientUtils.GetEditorValuesInContainer(FormLayout.GetMainElement());
}
function onEditorsChanged(s, e) {
    SaveButton.SetEnabled(true);
    CancelButton.SetEnabled(true);
    isDirty = true;
}
Note

Online demo To review the full code example mentioned above, refer to the Data Editors - Detecting Changes (Web Forms) or Data Editors - Detecting Changes (MVC) online demos.

See Also