Saving data

I am using IIS and put the dhtmlxscheduler in the wwwroot folder.
I looked at the tutorial sample “05_data_saving.html”
and when i try to add an event it adds it, but when i refresh the page it’s gone, doesn’t seem to save. What am i missing here?

I would like to be able to save data using an XML file or JSON.

the loading part worked for me with json

$$(“scheduler”).parse([
{ id:1, start_date:“2012-8-14 6:00”, end_date:“2012-8-14 8:00”, text:“Event 1”, details:“details here”},
{ id:2, start_date:“2012-8-15 18:00”, end_date:“2012-8-16 20:00”, text:“Event 2”, details:“details here”}
],“json”);

});

but how do i save events using json or xml file?

XML preferred!

nevermind i succeeded.

What i actually need to do is connect the data with an access database.
how should i do that?

You can try to use connectors lib with php or .net backend
In case of php you can use pdo connector, which allows to connect to Access database.

Need to say, we don’t have Access samples locally, so while it may work in theory - it never was test practically.

What if i need to run a query for selecting only some events to be shown?
Where should i do that?

It seems i was able to connect to the database but no data is loading.

I am not getting any php erros in the log.
Is there any other way to debug this problem?

I am able to save data to my Acess DB but not load or delete any of it from the scheduler.

this is my connector code:

[code]<?php
require(“connectors/grid_connector.php”);
require(“connectors/db_pdo.php”);

$res = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=db.mdb");

$scheduler = new GridConnector($res,“PDO”);
$scheduler->enable_log(“log.txt”,true);
$scheduler->render_table(“events”,“event_id”,“start_date,end_date,event_name (text),details”);

?>[/code]


this is html using the dhxscheduler:

[code]


Schedule





scheduler.config.init_date = new Date();

		dhx.ready(function(){
	        dhx.ui.fullScreen();
			dhx.ui({
			   		view: "scheduler",
					id: "scheduler",
					save: "scripts/myConnector.php"
			});
			$$("scheduler").load("scripts/myConnector.php","scheduler");
		});
	</script>
</head>
<body>
</body>
[/code]

Please help! much appreciated!!

Scheduler is not a jquery extension. You need to use Scheduler API.

You may call clearAll method to remove scheduler data and then load events you want:

$$(“scheduler”).clearAll();
$$(“scheduler”).load(…);

You need to use schedulerConnector:

require(“connectors/scheduler_connector.php”);
require(“connectors/db_pdo.php”);

$res = new PDO(“odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=db.mdb”);

$scheduler = new schedulerConnector($res,“PDO”);

Thank you very much! You just made my day!

Still have a problem updating and deleting though.
Getting a similar error on both.

When deleting i Receive this error:


====================================
Log started, 15/08/2012 03:42:39
====================================

DataProcessor object initialized
33_id => 33
33_start_date => 2012-08-15 15:41
33_end_date => 2012-08-15 16:41
33_text => Activity2
33_details => elya
33_value => 
33_!nativeeditor_status => delete
ids => 33

Row data [33]
event_id => 33
start_date => 2012-08-15 15:41
end_date => 2012-08-15 16:41
event_name => Activity2
details => elya
value => 
!nativeeditor_status => delete

DELETE FROM events WHERE event_id='33'

exception 'Exception' with message 'PDO - sql execution failed
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression. (SQLExecute[-3030] at ext\pdo_odbc\odbc_stmt.c:254)' in C:\inetpub\wwwroot\elya158\scheduler\scripts\connectors\db_pdo.php:20
Stack trace:
#0 C:\inetpub\wwwroot\elya158\scheduler\scripts\connectors\db_common.php(650): PDODBDataWrapper->query('DELETE FROM eve...')
#1 [internal function]: DBDataWrapper->delete(Object(DataAction), Object(DataRequestConfig))
#2 C:\inetpub\wwwroot\elya158\scheduler\scripts\connectors\dataprocessor.php(217): call_user_func(Array, Object(DataAction), Object(DataRequestConfig))
#3 C:\inetpub\wwwroot\elya158\scheduler\scripts\connectors\dataprocessor.php(168): DataProcessor->check_exts(Object(DataAction), 'delete')
#4 C:\inetpub\wwwroot\elya158\scheduler\scripts\connectors\dataprocessor.php(97): DataProcessor->inner_process(Object(DataAction))
#5 C:\inetpub\wwwroot\elya158\scheduler\scripts\connectors\base_connector.php(486): DataProcessor->process(Object(DataConfig), Object(DataRequestConfig))
#6 C:\inetpub\wwwroot\elya158\scheduler\scripts\connectors\base_connector.php(406): Connector->render()
#7 C:\inetpub\wwwroot\elya158\scheduler\scripts\myConnector.php(9): Connector->render_table('events', 'event_id', 'start_date,end_...')
#8 {main}

Edit operation finished
0 => action:error; sid:33; tid:33;

Done in 0.0068900585174561s

I removed the quotes from db_common DELETE Query and it works!

I removed the quotes from db_common DELETE Query and it works!

Access db doesn’t allow to use quotes for numeric fields in queries. So, your solution will do. If you do not want to modify connector code, you may execute custom queries. Here are docs about this approach:

docs.dhtmlx.com/doku.php?id=dhtm … ex_queries