Updating a single Event ?

Dear sirs

i have a really big problem and really hope that anybody can help me.
I’m working with “Units-View” and when i update an event i also make some changes in db to the rest of the events in this column.

So my problem is how can i refresh these events without reloading the whole page?

Really hope that there’s a solution :frowning:

Thank you in advance

Best regards
Oliver

After receiving update callback ( dp.attachEvent(“onAfterUpdate”, callback ) ) you can call

scheduler.load("data.php");

which will load new data, and will update positions and properties of events

I was trying the whole night but without success. How the “types.php” have to look like if i just want to update specified events?

dataprocessor

var dp2 = new dataProcessor("php/types.php");
dp2.attachEvent("onAfterUpdate", function(sid, action, tid, tag){
   scheduler.load("php/types.php");									  
});
dp2.init(scheduler);

types.php

<?php
	include ('../codebase/connector/scheduler_connector.php');
	include ('../common/config.php');
	
	$res=mysql_connect($server, $user, $pass);
	mysql_select_db($db_name);
	
	$list = new OptionsConnector($res);
	$list->render_table("types","typeid","typeid(value),name(label)");
	
	$scheduler = new schedulerConnector($res);
	//$scheduler->enable_log("log.txt",true);
	
	$scheduler->set_options("type", $list);
	  $scheduler->render_table("tevents","event_id","start_date,end_date,event_name,type,termin,termin_bemerkung,termin_klaerung,farbe,benutzer,gesendet,aktiv,body_text,entfernung,anschluss,abwesend");
?>

If i understand you right with this code scheduler should update ALL events right now after receiving any update … i would need this for specified events but happens nothing … what i do wrong?

a) you can reload the main datafeed - event updating has small performance costs, so it doesn’t really matter are you updating a single event or all events.

b) if you need to update only sub-set of events - you can use separate php file with render_sql instead of render_table ( you can combine url parameters and sql code to filter out necessary events )

You code looks correct, will events become updated after page refresh ?
Check the dev console - does request for data reloading sent to server side? Does server side return valid response ?

Ok … so i’m o nthe right way …
Yes … events became updated after i refresh the whole page.

hmm …

If I reload the whole page dev console says:

[14:28:58.692] GET https://www.mds.umdispotool.de/cal/php/types.php?timeshift=-60&uid=1364563738597&from=2013-03-30&to=2013-03-31 [HTTP/1.1 200 OK 325ms]

onAfterUpdate dev console says:

[14:27:24.413] POST https://www.mds.umdispotool.de/cal/php/types.php?editing=true [HTTP/1.1 200 OK 140ms]

There’s no GET-order ?!

POST is the updating command, it seems onAfterUpdate doesn’t fire at all.
What is response from server side for that POST ? Assuming that this is the same connector code - it must be a valid xml ( if, somehow, response is not valid - has wrong content type or not parsable xml - onAfterUpdate will not be triggered )

Connector code is defintely the same and on AfterUpdate also fires (i tried with an ALERT). Sorry for this question but how can i check server side response :blush: ?

ok … one step more … it works with:

scheduler.clearAll();												   scheduler.load("php/types.php");

a) Why ?
b) is there a way to clear just a specified column?

it does not work in IE.
How to solve?

The clearAll is not mandatory, in default case.
Are you using dynamical loading for the scheduler ? In such case it will maintain local cache to not reload data, and clearAll will definitely help.

As for IE - problem can be caused by browser level caching - try to modify the code as next

scheduler.load(“php/types.php?uid=”+(new Date()).valueOf());

It will add a random part to the url, which will prevent browser level caching.

Yes i’m using dynamical loading … is there a better way to reload “my” few events as reloading all the events?

You can use

scheduler._loaded = {}; //clear local cache scheduler.load(url);

Please beware that this is not a part of public API, and may be disabled in one of next versions.

I hope you will not because is exactly what i needed :smiley:

Thank you