this.getEvent(...) is undefined after clearAll() and load()


I have a problem with my scheduler. Everytime I update an event, I call a method named “clearCalendar”. Here is the content of this method :


But after loading, I have the following error message in Firebug console :

TypeError: this.getEvent(...) is undefined

located in my scheduler.js file :

scheduler.getUserData = function (id, name)
    return id ? this.getEvent(id)[name] : this._userdata[name];

I don’t understand why. I use a custom API in PhP to store and to retrieve events, I don’t use the dhtmlxConnector. The server response when I update an event is like this :

    <action type="updated" sid="6" tid="6"></action>

I don’t see anything wrong. Can anyone please help me ?

Thanks in advance.

The situation seem to be like next

  • data changed in the scheduler
  • dataprocessor sends info about changed event to the server side ( you are using dataprocessor, right ? )
  • above code clears all events and requests data reloading
  • dataprocessor response received, but event which was saved is not in scheduler anymore, because of clearAll command ( result of load is still not available ) - which results in error, when dataprocessor attempts to remove styling from non-existing event.

The best logic, will be to start the data reloading code not after changes in event, but after receiving confirmation from server side that data was saved. ( onAfterUpdate event of dataprocessor )

Also, if you want to update only one saved event , you can use scheduler.load without clear all - in such case scheduler will update existing events with new data.

Thanks for the answer. I have delete the “clearAll” call and everything seems to work perfectly.

Problem solved !