Lightbox hangs on newly created events

My scheduler is set up to accept new events via drag and drop from a tree. Everything is working perfectly there. When I double click the calendar to add an event manually, the lightbox will not go away when I click Save, Cancel or Delete. If I refresh the page, the event is on the calendar and the lightbox works perfectly. There are no issues with the lightbox when I drag a new event from the tree.

I’m not seeing any javascript errors with Firebug and the dhtmlxlog.txt file doesn’t seem different for one versus the other. My only attachedEvents are as follows

    scheduler.attachEvent("onExternalDragIn", function(id, source, e){
    var tree_item_id = tree._dragged[0].id; // getting tree item id
    scheduler._dragged_tree_item = tree_item_id; // setting custom flag with tree item id when item was dragged in
    var label = tree.getItemText(tree_item_id);
    var ev = scheduler.getEvent(id);
    ev.text = label;
    var addedby = tree.getUserData(tree_item_id,'addedby');
    var dispatch_id = tree.getUserData(tree_item_id,'dispatch_id');
    var job = tree.getUserData(tree_item_id,'job');
    var customer = tree.getUserData(tree_item_id,'customer');
    var supervisor = tree.getUserData(tree_item_id,'supervisor');
    var tech = tree.getUserData(tree_item_id,'tech');
    var location = tree.getUserData(tree_item_id,'location');
    var lat = tree.getUserData(tree_item_id,'lat');
    var lng = tree.getUserData(tree_item_id,'lng');
    ev.addedby=addedby;
    ev.dispatch_id=dispatch_id;
    ev.job=job;
    ev.customer=customer;
    ev.supervisor=supervisor;
    ev.tech=tech;
    ev.location=location;
    ev.lat=lat;
    ev.lng=lng;
    return true;
});
scheduler.attachEvent("onEventAdded", function(event_id){
if(tree._dragged[0].id){  
tree.deleteItem(tree._dragged[0].id);
}
else{
}
return true;                   

});
scheduler.attachEvent("onAfterLightbox", function () {
    scheduler._dragged_tree_item = false; // resetting flag after lightbox was closed
});

Hello,

From the top of my head:

scheduler.attachEvent("onEventAdded", function(event_id){ if(tree._dragged[0].id){
are you sure at this point tree._dragged[0] is defined?
Try changing to

if (tree._dragged && tree._dragged[0].id) {

And if that doesn’t help please provide link where we can check this issue.

Kind regards,
Ilya

No luck with that fix. Let me take the password off the site and then I’ll post the link.

Ah…I loaded it in Firefox to test to see if my password protection came off and Firebug in there does show the error:

tree._dragged[0] is undefined
[Break On This Error] 	

if(tree._dragged && tree._dragged[0].id){

Is there another way around this undefined problem?

Looks like this works!

scheduler.attachEvent("onEventAdded", function(event_id){
if (typeof tree._dragged == "undefined" || !(tree._dragged instanceof Array)) {
}else{
if(tree._dragged && tree._dragged[0].id){  
  tree.deleteItem(tree._dragged[0].id);
}
}
return true;                   
});

No, that didn’t fix it. I’m back to the same error.

[code]tree._dragged[0] is undefined
[Break On This Error]

if(tree._dragged && tree._dragged[0].id){[/code]

Me again…

Okay, I think this one is working right. Does anyone see a problem with it?

[code]scheduler.attachEvent(“onEventAdded”, function(event_id){
if( tree._dragged[0] === undefined ) {
// do something
}
else{
tree.deleteItem(tree._dragged[0].id);
}

return true;
});[/code]