Search.../

onAfterSave( )

Adds an event handler that runs just after a save.

Description

The onAfterSave() function allows you to optionally perform actions right after a save() operation. When you call save(), the callback is run after the save has successfully completed.

Calling onAfterSave() on a read-only dataset causes an error.

Syntax

function onAfterSave(handler: AfterSaveHandler): void
handler: function AfterSaveHandler(itemBeforeSave: Object, itemAfterSave: Object): void

onAfterSave Parameters

NAME
TYPE
DESCRIPTION
handler

AfterSaveHandler

The after save event handler.

Returns

This function does not return anything.

Return Type:

void

AfterSaveHandler Parameters

NAME
TYPE
DESCRIPTION
itemBeforeSave

Object

The item before being saved.

itemAfterSave

Object

The item after being saved.

Returns

This function does not return anything.

Return Type:

void
Mixed in from:wix-dataset.Dataset

Was this helpful?

Register a callback to run after a save

Code Example

Copy Code
1$w("#myDataset").onAfterSave( () => {
2 console.log("After save")
3});