Loading & Saving data

Loading data

To load events to the scheduler you should use the method load():

$$("scheduler_id").load("data/events.xml","xml");

The method load() takes 2 parameters:

  • url - the data url
  • type - the type of loading data: 'json', 'xml' or 'scheduler'

Related sample: samples/07_mobile/01_init.html

Supported data types

The mandatory data fields:

  • start_date - the start date of the event in the format 'yyyy-mm-dd hh:mm:ss'.
  • end_date - the end date of the event in the format 'yyyy-mm-dd hh:mm:ss'.
  • text - the title of the event.

The optional data fields:

  • details - the description of the event.
  • any custom.

json

[
 { id:1, start_date:"2011-05-24 00:00:00", end_date:"2011-06-08 00:00:00", text:"French Open", details:"Philippe-Chatrier Court Paris, FRA" },
 { id:2, start_date:"2011-06-10 00:00:00", end_date:"2011-06-13 00:00:00", text:"Aegon Championship", details:"The Queens Club London, ENG" }
]

xml

<data>
	<item id="1">
		<start_date>2011-05-24 00:00:00</start_date>
		<end_date>2011-06-08 00:00:00</end_date>
		<text>French Open</text>
		<details>Philippe-Chatrier Court Paris, FRA</details>
	</item>
        ...
</data>

scheduler

<data>
	<event id="1">
		<start_date>2011-05-24 00:00:00</start_date>
		<end_date>2011-06-08 00:00:00</end_date>
		<text>French Open</text>
		<details>Philippe-Chatrier Court Paris, FRA</details>
	</event>
        ...
</data>

Saving data

The mobile scheduler lets to save data back to DB. During scheduler's init you can specify the appropriate server file in the parameter 'save' of the object constructor.

dhx.ready(function(){
	dhx.ui({
		view: "scheduler",
		id: "scheduler",
		save: "php/events.php"
	});
	$$("scheduler").load("php/events.php","scheduler");
});

If you use dhtmlxConnector, the path to its file can be set as this parameter. In this case, dhtmlxConnector will do all the server work.

Related sample: samples/07_mobile/05_data_saving.html