How to create event by single clicking

I need to create new event when user single click on the empty space (without open lightbox). What I did is

[code]scheduler.attachEvent(“onEmptyClick”, function(date, native_event) {

var id = scheduler.addEvent(native_event);

});[/code]

addEvent triggered the saveEvent(DHXEv event, DHXStatus status) method of my CustomUnitsEventsManager but the id of the event passed to this method is null. Anyone knows why?