beforeAdd
fires before adding a new item into a data collection
beforeAdd: (newItem: object) => boolean | void;
Parameters:
newItem: object
- the object of an added item
Returns:
Return false
to prevent an item adding into a data collection; otherwise, true
.
Example
component.data.events.on("beforeAdd", function(newItem){
console.log("A new item will be added");
return true;
});