BeforeAdd

fires before adding a new item into a tree collection

boolean BeforeAdd(object newItem){ ... };

Parameters

newItemobjectthe object of an added item

Returns

booleantrue/false to add/not add an item

Example

data.events.on("BeforeAdd", function(newItem){
    console.log("A new item will be added");
    return true;
});

Details

The event is blockable. Return false to prevent an item adding into a data collection.

See also
Back to top