Skip to content

onBeforeAdd

fires before adding an item to the datastore

function onBeforeAdd(
// the ID of the newly added data item
id: string|number,
// data for the new item
obj: object,
// the index, at which the new item will be added
index: number
): boolean

boolean false, if the operation needs to be cancelled

grid.data.attachEvent("onBeforeAdd", function(id, obj, index){
if (obj.text == "")
return false;
});

Returning false from the event handler will block further processing, and the item will not be added.