Datas from 2 different sources

Hi,
Sorry but I’ve not response to this…
How display events from 2 different sources?

  • One is coming from a DB, and is running when the lonely.
  • Second is in-line text like this:

scheduler.parse([ { start_date: "2015-11-26 00:00:00", end_date: "2015-11-27 00:00:00", text:"8", commentaire:"Marc" }, { start_date: "2015-11-29 00:00:00", end_date: "2015-11-30 00:00:00", text:"8", commentaire:"Maria" }, { start_date: "2015-11-15 00:00:00", end_date: "2015-11-16 00:00:00", text:"8", commentaire:"Irina" }, ],"json");

The events coming from the DB are not display when the second text line is used.

Do you know why?

Thank you…

Check

docs.dhtmlx.com/scheduler/loadin … plesources

Just be sure that you have unique IDs for events ( if same ID used in both sources, first event will overwrite the second one )

Thank’

I don’t understand how to call data in-line with the code you propose.

scheduler.load(["first/source/some.xml","second/source/other.xml"]);

Have I to create an order page with datas treatment or can I let it inline?

And, yes, id’s are differents, 'd check that.

Hello,
After few days research, I’m still looking for a solution…
Any Ideas?

Issuing two loading command will work without any conflicts, please check the next snippet.

docs.dhtmlx.com/scheduler/snippet/f10e9cdf

Can you please confirm that after removing the parse command, loading from the first datasource works correctly in your app. Also, are using the same data type ( json ) for data loading and data parsing ?

Thank you Stanislav,

Including your code (as shown), I have the same result… no loading datas from the DB. But without inline parsing text, everything work ok…

  • If the probleme is the DB datas are not converted in JSON, how to do that?
  • Are the arguments from the parsing text and the loaded datas to be exactly the same?

[code]
// input IMPORTE DE DB SQL
scheduler.setLoadMode(“month”);
scheduler.load(“dhtmlxschedulerv4/codebase/connector.php”);
//scheduler.parse(small_events_list, “json”);

scheduler.parse([
{ start_date: “2015-12-26 00:00:00”, end_date: “2015-12-26 24:00:00”, text:“8”, commentaire:“Marc” , hg:“0” },
{ start_date: “2015-12-29 00:00:00”, end_date: “2015-12-29 24:00:00”, text:“8”, commentaire:“Maria”, hg:“0” },
{ start_date: “2015-12-15 00:00:00”, end_date: “2015-12-15 24:00:00”, text:“8”, commentaire:“Irina”, hg:“0” },
],“json”);

	// INTRO DES ANNIFS

// scheduler.parse([<?php
// echo $parse_conges;
// if ((!($parse_conges==’’))&&(!($parse_annifs==’’))) {
// echo ', ';
// }
// echo $parse_annifs;
// ?>
// ],“json”);
[/code]

Hi,

Is anybody has any idea?

Thank’s a lot… I’m desperate…

Hi

scheduler.setLoadMode("month"); this line can interfere with loading data from two datasource.
Try to move .parse command before .setLoadMode and .load calls.

Also, if it somehow still doesn’t help. You can replace scheduler.parse with something like

for (var i=0; i<dataset.length; i++) scheduler.addEvent(dataset[i]);

Thank you,
I 've tried the first solution by moving the parsing but it wasn’t the good one.
The second is running but, the problem is: Adding the events, they are created on the DB. This I wanted to avoid. I need those events be only displayed without saving on DB.
That was obtained with the parse method but … :frowning:
Is it possible to display new created event without saving??

It’s ok.
I’d not use my brain…

I 'd just to move the addEvent before the saving process like this…

	// JOURNEE TRAVAUX
	var travo1=[<?php 
  echo $parse_travo; ?>];
	if (!(travo1[0]=='')) {
		for (var i=0; i<travo1.length; i++) 
    	scheduler.addEvent(travo1[i]);
	}
		

	// OUtput SAUVEGARDE dansDB SQL
	var dp = new dataProcessor("dhtmlxschedulerv4/codebase/connector.php");
	dp.init(scheduler);	
	dp.enableUTFencoding(false);
	
	scheduler.setLoadMode("month");
	scheduler.load("dhtmlxschedulerv4/codebase/connector.php");

Thank’s a lot for your time!

IT’S OK!!!

Thank you for your time, Stan.

I had just to place the addEvent before the saving process… obviously!

	// JOURNEE TRAVAUX
	var travo1=[<?php 
  echo $parse_travo; ?>];
	if (!(travo1[0]=='')) {
		for (var i=0; i<travo1.length; i++) 
    	scheduler.addEvent(travo1[i]);
	}
		

	// OUtput SAUVEGARDE dansDB SQL
	var dp = new dataProcessor("dhtmlxschedulerv4/codebase/connector.php");
	dp.init(scheduler);	
	dp.enableUTFencoding(false);
	
	scheduler.setLoadMode("month");
	scheduler.load("dhtmlxschedulerv4/codebase/connector.php");