update color

When I change the calendar on one of my appointments, the color does not change I have to do F5 to see the right color.
How will it be possible to update the color when the validation of the appointment?

Here are my two files:

calendar.php

<!doctype html>

Loading data from a database

html, body{ margin:0px; padding:0px; height:100%; overflow:hidden; } <? require('../dbconnect.php'); if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} $vendor_lead_code = $vendor_id; if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} if (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];} elseif (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];} if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} if (isset($_GET["title"])) {$title=$_GET["title"];} elseif (isset($_POST["title"])) {$title=$_POST["title"];} if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];} elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];} if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} if (isset($_GET["address1"])) {$address1=$_GET["address1"];} elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];} if (isset($_GET["address2"])) {$address2=$_GET["address2"];} elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];} if (isset($_GET["address3"])) {$address3=$_GET["address3"];} elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];} if (isset($_GET["city"])) {$city=$_GET["city"];} elseif (isset($_POST["city"])) {$city=$_POST["city"];} if (isset($_GET["state"])) {$state=$_GET["state"];} elseif (isset($_POST["state"])) {$state=$_POST["state"];} if (isset($_GET["province"])) {$province=$_GET["province"];} elseif (isset($_POST["province"])) {$province=$_POST["province"];} if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} if (isset($_GET["gender"])) {$gender=$_GET["gender"];} elseif (isset($_POST["gender"])) {$gender=$_POST["gender"];} if (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];} elseif (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];} if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} if (isset($_GET["email"])) {$email=$_GET["email"];} elseif (isset($_POST["email"])) {$email=$_POST["email"];} if (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];} elseif (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];} if (isset($_GET["comments"])) {$comments=$_GET["comments"];} elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];} if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];} elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];} if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];} elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];} if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];} elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];} if (isset($_GET["closer"])) {$closer=$_GET["closer"];} elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];} if (isset($_GET["group"])) {$group=$_GET["group"];} elseif (isset($_POST["group"])) {$group=$_POST["group"];} if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];} elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];} if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];} elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];} if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];} elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];} if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];} elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];} if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];} elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];} if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} if (isset($_GET["phone"])) {$phone=$_GET["phone"];} elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];} elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];} if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];} elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];} if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];} elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];} if (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];} elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];} if (isset($_GET["rank"])) {$rank=$_GET["rank"];} elseif (isset($_POST["rank"])) {$rank=$_POST["rank"];} if (isset($_GET["owner"])) {$owner=$_GET["owner"];} elseif (isset($_POST["owner"])) {$owner=$_POST["owner"];} if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];} elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];} if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];} elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];} if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];} elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];} if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];} elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];} if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];} elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];} if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];} elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];} if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];} elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];} if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];} elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];} if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];} elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];} if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];} elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];} if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];} elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];} if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];} elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];} if (isset($_GET["preset_number_a"])) {$preset_number_a=$_GET["preset_number_a"];} elseif (isset($_POST["preset_number_a"])) {$preset_number_a=$_POST["preset_number_a"];} if (isset($_GET["preset_number_b"])) {$preset_number_b=$_GET["preset_number_b"];} elseif (isset($_POST["preset_number_b"])) {$preset_number_b=$_POST["preset_number_b"];} if (isset($_GET["preset_number_c"])) {$preset_number_c=$_GET["preset_number_c"];} elseif (isset($_POST["preset_number_c"])) {$preset_number_c=$_POST["preset_number_c"];} if (isset($_GET["preset_number_d"])) {$preset_number_d=$_GET["preset_number_d"];} elseif (isset($_POST["preset_number_d"])) {$preset_number_d=$_POST["preset_number_d"];} if (isset($_GET["preset_number_e"])) {$preset_number_e=$_GET["preset_number_e"];} elseif (isset($_POST["preset_number_e"])) {$preset_number_e=$_POST["preset_number_e"];} if (isset($_GET["preset_number_f"])) {$preset_number_f=$_GET["preset_number_f"];} elseif (isset($_POST["preset_number_f"])) {$preset_number_f=$_POST["preset_number_f"];} if (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];} elseif (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];} if (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];} elseif (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];} if (isset($_GET["did_id"])) {$did_id=$_GET["did_id"];} elseif (isset($_POST["did_id"])) {$did_id=$_POST["did_id"];} if (isset($_GET["did_extension"])) {$did_extension=$_GET["did_extension"];} elseif (isset($_POST["did_extension"])) {$did_extension=$_POST["did_extension"];} if (isset($_GET["did_pattern"])) {$did_pattern=$_GET["did_pattern"];} elseif (isset($_POST["did_pattern"])) {$did_pattern=$_POST["did_pattern"];} if (isset($_GET["did_description"])) {$did_description=$_GET["did_description"];} elseif (isset($_POST["did_description"])) {$did_description=$_POST["did_description"];} if (isset($_GET["closecallid"])) {$closecallid=$_GET["closecallid"];} elseif (isset($_POST["closecallid"])) {$closecallid=$_POST["closecallid"];} if (isset($_GET["xfercallid"])) {$xfercallid=$_GET["xfercallid"];} elseif (isset($_POST["xfercallid"])) {$xfercallid=$_POST["xfercallid"];} if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];} elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];} if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];} elseif (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];} if (isset($_GET["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_GET["CF_uses_custom_fields"];} elseif (isset($_POST["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_POST["CF_uses_custom_fields"];} if (isset($_GET["entry_list_id"])) {$entry_list_id=$_GET["entry_list_id"];} elseif (isset($_POST["entry_list_id"])) {$entry_list_id=$_POST["entry_list_id"];} if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} if (isset($_GET["user_group"])) {$user_group=$_GET["user_group"];} elseif (isset($_POST["user_group"])) {$user_group=$_POST["user_group"];} if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} $txt = '.txt'; $StarTtime = date("U"); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $CIDdate = date("mdHis"); $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; $script_height = ($script_height - 20); session_start(); $_SESSION['campaign_id'] = $campaign; $res=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass"); if (!$res) { die('MySQL connect ERROR: ' . mysql_error()); } mysql_select_db("$VARDB_database"); $stmt = "select digi_campaign_calendar.ScheduleID, calendar_name,calendar_color from digi_campaign_calendar inner join digi_calendar on digi_campaign_calendar.ScheduleID=digi_calendar.ScheduleID where campaign_id='".$campaign."'"; $result =mysql_query($stmt, $res); ?>
<?php if ($result) : ?> <?php while ($row = mysql_fetch_assoc($result)) { echo '"'. $row['calendar_name']. '"'; } ?> <?php endif ?>
 
 
<script>
        $(document).ready(function () {
           

			$("#calendar_list").on("change", function(e) { 
			console.log("selecting val="+ $("#calendar_list").children("option").filter(":selected").text() );
			var calendar_list = []; 

$(’#calendar_list :selected’).each(function(i, selected){
calendar_list[i] = $(selected).val();
});
console.log(calendar_list);
scheduler.clearAll();
scheduler.load(“data/events.php?calendar_list=”+calendar_list);
});

		});
        			
    </script>
    
    <script>

events.php

<?php include('../../calendar/codebase/connector/scheduler_connector.php'); require('../../dbconnect.php'); if (isset($_GET["calendar_list"])) {$calendar_list=$_GET["calendar_list"];} elseif (isset($_POST["calendar_list"])) {$calendar_list=$_POST["calendar_list"];} $res=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass"); if (!$res) { die('MySQL connect ERROR: ' . mysql_error()); } mysql_select_db("$VARDB_database"); mysql_query("SET NAMES utf8;", $res); $list = new OptionsConnector($res); $list->render_table("digi_calendar","ScheduleID","ScheduleID(value),calendar_name(label)"); $calendar = new SchedulerConnector($res); $calendar->enable_log("log.txt",true); //$calendar->enable_log("log.txt",true); session_start(); $campaign_id = trim($_SESSION["campaign_id"]); ?>

alert (<? echo $campaign_id;?>);

<? //$calendar->render_table("`digi_calendar_events`","id","start_date_time,end_date_Time,subject,description,calendar_id"); function default_values($action){ global $calendar_id; $calendar_id = $action->get_value("calendar_id"); if ($calendar_id == "") $calendar_id = $_SESSION["s_user_cal_id"]; $action->set_value("calendar_id",$calendar_id); } $calendar->event->attach("beforeProcessing","default_values"); if ($calendar->is_select_mode()) { $calendar->set_options("calendar_id", $list); $calendar->render_sql("SELECT e.*, digi_calendar.calendar_color as color, calendar_name FROM `digi_calendar_events` e INNER JOIN digi_campaign_calendar c ON e.calendar_id = c.ScheduleID INNER JOIN digi_calendar on c.ScheduleID=digi_calendar.ScheduleID WHERE c.campaign_id = '".$campaign_id."' and calendar_id in (".$calendar_list.")", "id","start_date_time,end_date_Time,subject,description,calendar_id,calendar_name,color,readonly"); } else { echo('test'); $calendar->set_options("calendar_id", $list); $calendar->render_table("`digi_calendar_events`","id","start_date_time,end_date_Time,subject,description,calendar_id"); } ?>

Hello,
the color of event can be defined either by a css class in event_class template or by .color property of an event object

From your code it seems you attach color as a property during data loading in events.php:
$calendar->render_sql("SELECT e.*, digi_calendar.calendar_color as color

But the color is not updated on the client-side after the event calendar is changed. In order to update color without reloading the data you need to assign new color value to the event object on the client-side

docs.dhtmlx.com/scheduler/custom … color.html