coloring the event using server side data


#1

Hello everyone,

I am using scheduler in dhtmlx.

So in that I want to set color for each event from database.

Using one table it’s fine(setting color if it is in primary table while joining).
I want to set color of event when color column is in secondary table in table joining.

I am using php and mysqli.

this is my index.php file

[code]

How to start html, body{ margin:0px; padding:0px; height:100%; overflow:hidden; }
my row
 
 
[/code]

And this is connector

[code]<?php
require_once("…/…/codebase/connector/scheduler_connector.php");
require("…/…/codebase/connector/db_mysqli.php");

$mysqli = new mysqli(‘localhost’, ‘root’, ‘’, ‘mycalendar’);
$list->render_table(“events”,“id”,“textColor(value),textColor(label)”);*/
$details = new JSONDataConnector($mysqli, “MySQLi”);
$details->configure(“users”,“id”,“textColor,color,username”);
$details->enable_log(“logd.txt”,true);
$events = new JSONSchedulerConnector($mysqli, “MySQLi”);
$events->mix(“users”, $details, array(
“id” => “user_id”
));
$events->enable_log(“log.txt”,true);
$events->render_table(“events”,“id”,“start_date,end_date,text,rec_type,event_pid,event_length,user_id”,"","");
?>[/code]

Please help!!!


#2

Hi,

Unfortunately I’m not fully understand what you try to achieve.

Perhaps this way can help you to solve the issue.
You can specify the color as a property of event object. To change this value by the lightbox, you should create a list of options using serverList. So it will be possible to configure the color using the lightbox.

Please see example how it works docs.dhtmlx.com/scheduler/snippet/30aa1e11


#3

figured it out…
in this event that I had, added the code there…

    scheduler.templates.event_class=function(start, end, event){
        event.textColor = "white";
        
        if(event.rec_type == 'EXPIRY')
            event.color = "red";               
        else if(event.rec_type == 'LEAD_NOTE')
            event.color = "green";
        else if(event.rec_type == 'USER_EVENT')
            event.color = "blue";
                
        if (event.userId == CurrentUserID)                 
            return "user_" + CurrentUserID;                                 
    };

#4

Hi Sticcino,
please check my reply here.