onBeforeAdd

fires before adding an item to the datastore

boolean onBeforeAdd(string|number id,object obj,number index){ ... };

Parameters

idstring|numberthe ID of the newly added data item
objobjectdata for the new item
indexnumberthe index, at which the new item will be added

Returns

booleanfalse, if the operation needs to be cancelled

Example

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

Details

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

See also
Back to top
If you have not checked yet, be sure to visit site of our main product Webix javascript framework and page of javascript menu product.