LocalStore Events

This section describes events fired by this Store.

Subscribing to any event described in this section is equivalent to passing the event handling function to the corresponding configuration option. The only difference is that the function passed to the configuration option is the first within the stack of event handlers.

inserted

Fired after a data item has been added.

Event Handler Arguments:
values: Object
An object representing the inserted item.
key: Object
A key value of the inserted item.
JavaScript
myStore.inserted.add(function() {
    console.log("A data item has been inserted");
});

inserting

Fired before a data item is added.

Event Handler Arguments:
values: Object
An object representing the item being inserted.
JavaScript
myStore.inserting.add(function() {
    console.log("A data item is being inserted");
});

loaded

Fired after data has been loaded.

Event Handler Arguments:
result: Array
The loaded data array.
JavaScript
myStore.loaded.add(function() {
    console.log("The data has been loaded");
});

loading

Fired before data is loaded.

Callback Function Argument Structure:
filter: Object
A filter expression for the loaded data.
sort: Object
A sort expression for the loaded data.
select: Object
An expression for selection in the loaded data.
group: Object
An expression for grouping in the loaded data.
skip: Number
The number of items to skip.
take: Number
The number of items to take for the loaded data.
userData: Object
A bag for holding user-defined parameters.
requireTotalCount: Boolean
Specifies whether the event handling function should resolve the jQuery.Deferred with the second argument containing the **totalCount** field.
JavaScript
myStore.loading.add(function() {
    console.log("The data is being loaded");
});

modified

Fired after data has been modified.

JavaScript
myStore.modified.add(function() {
    console.log("The data has been modified");
});

modifying

Fired before the data is modified.

JavaScript
myStore.modifying.add(function() {
    console.log("The data is being modified");
});

removed

Fired after a data item has been removed.

Event Handler Arguments:
key: Object
A key value of the removed item.
JavaScript
myStore.removed.add(function() {
    console.log("A data item has been removed");
});

removing

Fired before a data item is removed.

Event Handler Arguments:
key: Object
A key value of the item being removed.
JavaScript
myStore.removing.add(function() {
    console.log("A data item is being removed");
});

updated

Fired after a data item has been updated.

Event Handler Arguments:
key: Object
A key value of the updated item.
values: Object
New item values.
JavaScript
myStore.updated.add(function() {
    console.log("A data item has been updated");
});

updating

Fired before a data item is updated.

Event Handler Arguments:
key: Object
A key value of the item being updated.
values: Object
New item values.
JavaScript
myStore.updating.add(function() {
    console.log("A data item is being updated");
});