I have this function
function actionInsert($action){
$rs=mysql_query(“select max(event_id) from eventos”);
$row = mysql_fetch_row($rs);
$nuevoid= $row[0]+1;
$event_name=$action->get_value(“event_name”);
$start_date=$action->get_value(“start_date”);
$end_date=$action->get_value(“end_date”);
mysql_query(“insert into eventos (event_id
,date
,start_date
,end_date
,event_name
,autorID
,agendaID
) values (’$nuevoid’,’$start_date’,’$start_date’,’$end_date’,’$event_name’,’{$_SESSION[“idu”]}’,’{$_SESSION[“agendaID”]}’)”);
$action->success($nuevoid);
}
$scheduler->event->attach(“beforeInsert”,“actionInsert”);
I can not set the id at client side to $nuevoid , i have to reload the page in order to see the real event. Any idea?
Please be sure that next line
$scheduler->event->attach(“beforeInsert”,“actionInsert”);
is used before render_sql or render_table command
The code looks correctly, and must return $nuevoid as new ID value.
You can try to use dhtmlxscheduler_debug.js instead of compressed version - it will show the server side responses for saving actions. Please check which value is returnted as action@tid - it must be the new ID , which is generated by server side code.