View Full Version : No Store beforeAdd event?

10 Sep 2009, 12:17 PM
I have a situation where I would like to trap a record before it gets added to a store, so that I have the option of intercepting it and canceling it. But, it appears as though there is only an add event. Is this something that can be added via an override or something? Any help would be appreciated.

11 Sep 2009, 6:23 AM
It's a bit weird that you would need a 'beforeadd' event if you are calling store.add() yourself.

There is no 'beforeadd' event, but you can do an inline override of the add method, e.g.

var store = new Ext.data.Store({
add: function(records){
// test stuff here and optionally call:
return this.constructor.prototype.add.call(this, records);