onBeforeAdd

fires before adding an item to the datastore

boolean onBeforeAdd(string|number id,object obj,number index);
id
string|numberthe ID of the newly added data item obj
objectdata for the new item index
numberthe index, at which the new item will be added
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
  • API
  • Articles
  • Back to top
    Join Our Forum
    We've retired comments here. Visit our forum for faster technical support, connect with other developers, and share your feedback there.