Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stan on Oct 21, 2009 09:20
open dhtmlx forum
dhtml scheduler - date and time

Is there a way to store the start date and time seperately in a table?
Answer posted by Alex (support) on Oct 22, 2009 01:51

It is possible to use sevaral tables. 

But you should use render_sql instead of render_table method http://www.dhtmlx.com/dhxdocs/doku.php?id=dhtmlxconnector:loading_editing_data

And moreover you need to use onBeforeProcessing event  to save the event data. 

Answer posted by Stan on Oct 22, 2009 07:54
Alex, thank you for the quick response.  I am having problems getting the date time to seperate in the start_date and end_date.  If it is not to much trouble may I please see an example.
Answer posted by Alex (support) on Oct 22, 2009 08:22

The example for scheduler rendering:

scheduler->event->attach("beforeRender",doBeforeRender);


function doBeforeRender($data){
  $temp1 = $data->get_value("date_start");
  $temp2 = $data->get_value("time_start");
  $data->set_value($temp1." ".$temp2);
}

scheduler->render_sql("SELECT * from tableA INNER JOIN tableB ON tableA.ida=tableB.idb", "ida","date_start,date_end, text", "time_start,time_end", "");

In order to save the date and time seperately you can use beforeProcessing event:

scheduler->event->attach("beforeProcessing",doBeforeProcessing);


function doBeforeProcessing($action){
  $date1 = $action->get_value("date_start");
  $time1 = $data->get_value("time_start");
 .../*code that updates these values in the database */
}


Answer posted by Stan on Oct 22, 2009 08:43
Wow you rock!!  Would I need a function for the update and delete as well?