Updating / Reloading a single event after it's been created?

I have searched the forum for a straight solution to the following:

When an event is created, the database does several alterations to the data through stored procs. Because the event is not reloaded automatically after creation, some aspects of the new event are not present.

I can’t use the clearAll() and reload the entire calendar xml as that creates a very jarring experience for the users.

How can I “clear” the new event from the calendar and replace it with a targetted reload from the database after creation? I have tried using an event_id targetted xml load from the source on after event created, but although it makes the call, the event is not updated.

Any suggestions?

the event is not updated
If id of event on client side and id in the incoming xml is the same - existing event will be updated with new info from incoming xml. So just be sure that ID is the same

I was pretty sure that it was the same. I will go and check again.

This is my code, but it is not doing anything:

scheduler.attachEvent("afterEventAdded", function(sid, action, tid, tag){ scheduler.load(["SaveLoad2.asp?eventid="+tid]); return true; });

SaveLoad2.asp has code which takes parameter eventid and retrieves event with that database event id.

after I initialize the dtaprocessor, I have put the following code:

[code]dp.attachEvent(“onAfterUpdate”,function(sid,action,tid,xml_node){

scheduler.load([“SaveLoad2.asp?evid=”+tid]);
//alert(“SaveLoad2.asp?evid=”+tid);
scheduler.setCurrentView(scheduler.getState().date)
return true;
});[/code]

it doesn’t do anything when it comes to this line (not even attempting to load as Fiddler 2 registers no http activity at all at that stage):

scheduler.load(["SaveLoad2.asp?evid="+tid]);

if I un-comment the alert line, it does however alert with the correct event tid value.

I feel like I’m sooo close yet sooo far away…

OK, so I have changed my code slightly, and something very interesting has occurred:

dp.attachEvent("onAfterUpdate",function(sid,action,tid,xml_node){ //scheduler.clearAll(); scheduler.load("SaveLoad2.asp?evid="+tid+" "); return true; });

If I un-comment the //scheduler.clearAll(); the line after is triggered and the calendar is cleared and the correct single event is loaded, but if I leave it commented, the scheduler.load("SaveLoad2.asp?evid="+tid+" "); line is ignored completely.

How do I make the scheduler.load("SaveLoad2.asp?evid="+tid+" "); line trigger WITHOUT using the clearAll() ?

tried this:

[code] dp.attachEvent(“onAfterUpdate”,function(sid,action,tid,xml_node){
scheduler.clear_event(tid);
scheduler.load(“SaveLoad2.asp?evid=”+tid+" ");

});[/code]

and it clears the individual event, but then the scheduler.load("SaveLoad2.asp?evid="+tid+" "); line still doesn’t fire.

Trying pretty much everything here. Anyone out there encounter this?

OK, so I have a solution to the issue. Probably.
I will test more thoroughly before stating it is a definite solution.

  1. In the dhtmlxscheduler.js file I created a new variant on the clearAll function:

scheduler.clearAll2 = function () { // this._events = //{ //}; this._loaded = { }; //this.clear_view() };

  1. My on-page code now looks like this:

[code] dp.attachEvent(“onAfterUpdate”,function(sid,action,tid,xml_node){

scheduler.clearAll2();
scheduler.load(“SaveLoad2.asp?evid=”+tid+" ");

});[/code]

It may need some tweaking to cope with occasionally slower database updates by sp’s but that I might use setTimeout for.

Can you foresee any major issues with this solution?

If you are using scheduler.setLoadMode - scheduler will check currently visible range and will load data only if it was not loaded yet. ( it is useful for dynamic loading )

By clearing scheduler._loaded you are clearing local cache, so scheduler may call to the server side, for some date ranges, second time. ( it will not cause problems, just extra client-server communications )

I think you can use the next logic

scheduler.setLoadMode(false); scheduler.load(...some url...); scheduler.setLoadMode("month");//or any other necessary value

Such logic will temporary disable dynamic loading, so it will not affect you direct load call.

tried the suggested option, but no dice. The reload of the event then does not trigger. Unless I run into massive server traffic issues, I will have to stick with my mod. Thanks anyways. maybe my solution will help someone else too.

I’m also interested in a solution for reloading a single event from the server. Is there any progress (except using tweaked code) ?