Adding new attribute to event after insert

Hi,

I have an attribute “gmt_time” added to the event on load. This value is displayed in one of the lightbox sections of the event. However my problem is when creating a new event and I try to assign the correct value to this attribute after a successful insert i get this error:

Cannot read property 'gmt_time' of undefined

Here’s the code:

[code]dp.defineAction(“updated”, successful_update);
dp.defineAction(“inserted”, successful_update);

  function successful_update(node){
    var events = scheduler.getEvents();
    event = scheduler.getEvent(node.getAttribute("tid"));
    event.gmt_time = node.getAttribute("gmt_time");
    scheduler.updateEvent(node.getAttribute("tid"));
    return true;
  }[/code]

Hi,
you need to use “sid” attribute to get an event, because its ID is not yet changed. You also don’t really need to call “updateEvent” method which only re-render event in the scheduler. When you change text, color, start/end date - it’s necessary. But when you change some “invisible” properties you can skip this step.

function successful_update(node) { var event = scheduler.getEvent(node.getAttribute("sid")); event.gmt_time = node.getAttribute("gmt_time"); return true; }