DHTMLX Docs & Samples Explorer

Server side integration

Data loading

Scheduler can load data as in XML or iCal format

XML

     //scheduler.load(url,callback);
     scheduler.load("data.php");
<data>
	<event id="2">
		<start_date>2009-05-24 00:00:00</start_date>
		<end_date>2009-06-08 00:00:00</end_date>
		<text><![CDATA[French Open]]></text>
		<details><![CDATA[Philippe-Chatrier Court Paris, FRA]]></details>
	</event>
	<event id="3">
		<start_date>2009-06-10 00:00:00</start_date>
		<end_date>2009-06-13 00:00:00</end_date>
		<text><![CDATA[Aegon Championship]]></text>
		<details><![CDATA[The Queens Club London, ENG]]></details>
	</event>
</data>

Mandatory values:

  • start_date - format defined by scheduler.config.xml_date
  • end_date
  • text

Any other optional elements can present , they will be mapped to related event properties.

iCal

Only events with fixed start and end date supported.

     //scheduler.load(url,"ical",callback);
     scheduler.load("data.php","ical");
BEGIN:VCALENDAR
PRODID:-//Last.fm Limited Event Feeds//NONSGML//EN
VERSION:2.0
X-WR-CALNAME:Last.fm Events
X-WR-CALDESC:Event listing - supplied by http://www.Last.fm
 
BEGIN:VEVENT
UID:LFMEVENT-1043574
URL;VALUE=URI:http://www.last.fm/event/1043574
DTSTAMP:20090507T190000
DTSTART:20090507T190000
DTEND;VALUE=DATE:20090507
SUMMARY:Cross.B.Band
DESCRIPTION:Cross.B.Band 
END:VEVENT
 
BEGIN:VEVENT
UID:LFMEVENT-965499
URL;VALUE=URI:http://www.last.fm/event/965499
DTSTAMP:20090507T200000
DTSTART:20090507T200000
DTEND;VALUE=DATE:20090507
DESCRIPTION:some content here
END:VEVENT
 
END:VCALENDAR

DTSTART, DTEND - used as start and end of event DESCRIPTION - used as text of event all attriubutes of event from iCal structure mapped to the properties of event with the same name

Connector

Scheduller includes dataProcessor and can use it to sync. with server ( if you want to implement custom server side logic you can check dataProcessor article )

		scheduler.init('scheduler_here',null,"month");
		scheduler.load("events.php?uid="+scheduler.uid());
 
		var dp = new dataProcessor("events.php");
		dp.init(scheduler);
	include ('dhtmlxConnector/codebase/scheduler_connector.php');
 
	$res=mysql_connect("localhost","root","");
	mysql_select_db("sampleDB");
 
	$calendar = new SchedulerConnector($res);
	$calendar->render_table("events","id","event_start,event_end,event_text","type");

The third parameter must have 3 mandatory fields:

  • event field mapped to start date;
  • event field mapped to end date;
  • event field mapped to event text.

For more details about connector usage - you can check Connectors documentation

Samples for different platforms

Dynamical loading

By default scheduler load all data at once. It may be problematic in case of big event collections. In such situation dynamical event loading can be used - in case of dynamical loading, scheduler will load only part of event, necessary to fill current viewable area.

    scheduler.setLoadMode("month");
    scheduler.load("some.php");

Possible values are

  • year
  • month
  • day

If setLoadMode was used , scheduler will generate calls as

    some.php?from=DATEHERE&to=DATEHERE

where DATEHERE - will be a valid date values, format of which is defined by scheduler.config.load_date (%Y-%m-%d by default)

In case of “month” mode - calendar will request data for each month ( it is clever enough, to cache already used data - so requests will be sent only once per month )

If you are using dhtmlxConnector at server side, library is aware of such use-case and can be used in dyn. mode without any additional server side settings.

Multiple sources

If you need to load data dynamically from multiple sources - it can be organized by using related extension

Loading indicator

You can include loading indicator by using

      scheduler.config.show_loading=true;

If you can change loading image to different one - just replace imgs/loading.gif with different one