Skip to main content

beforeRemove

fires before removing an item/items from a data collection

beforeRemove: (removedItem: IDataItem, batch: IDataItem[], index: number) => boolean | void;

Parameters:

  • removedItem: object - the object of an item to remove
  • batch: array - an array of removed items
  • index: number - the index of the removed item within the batch

Returns:

Return false to block removing an item from a data collection; otherwise, true.

Example

component.data.events.on("beforeRemove", function(removedItem, batch, index){
console.log("Items will be removed");
return true;
});