database updating but scheduler view not

I have added the below attach event code because I needed to force some foreign keys to specific values. However it seems to have created an issue with database update/scheduler update. If I create a new event (let’s say in the month view), it gets created in the database and shows properly in the month view. If I then click on the event and delete it, it does not get deleted from the database. It also is not there if I switch to a different view (day, weekly). If I refresh the browser, then it appears in the other views and if I want to delete it, it will be deleted. Somehow, I guess scheduler is not registering the new event, even though it shows on the page where I created it and even though it is sent to the database. I’m obviously missing something simple.
Thanks in advance,

scheduler.attachEvent("onEmptyClick", function(id, e) {
	var action_data = scheduler.getActionData(e);
	  var event = {
		end_date:, 5, "minute"),
                    student_id: action_data.section,
                    user_id: 1,
                    company_id: 1
});  // end of attachEvent on Emptyclick