Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by mahesh on Oct 21, 2009 23:21
open dhtmlx forum
dthmlx scheduler: customized view and multiple resources combined

I can get the customization and mutiple resources to work independently. When I combine them, I fail to get the individual resources link in the upper left.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title></title>
</head>
    <script src="../../codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" href="../../codebase/dhtmlxscheduler.css" type="text/css" title="no title" charset="utf-8">
<script src="../../codebase/dhtmlxscheduler_units.js" type="text/javascript" charset="utf-8"></script>

    
<style type="text/css" media="screen">
    html, body{
        margin:0px;
        padding:0px;
        height:100%;
        overflow:hidden;
    }    
</style>

<script type="text/javascript" charset="utf-8">
    function init() {

var sections=[
        {key:1, label:"Raymond Hung"},
        {key:2, label:"Ed Lebowitz"},
        {key:3, label:"Harry Morrison"},
        {key:4, label:"Richard Silberstein"},
{key:5, label:"Stan Zipser"}
    ];
        scheduler.locale.labels.workweek_tab = "W-Week"
        scheduler.locale.labels.decade_tab = "Decade"
        

        //scheduler.config.multi_day=1;
//scheduler.config.readonly=1;
scheduler.config.xml_date="%Y-%m-%d %H:%i";
scheduler.config.hour_size_px=75;
        scheduler.config.lightbox.sections=[    
            {name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
{name:"custom", height:23, type:"select", options:sections, map_to:"section_id" },
            {name:"time", height:72, type:"time", map_to:"auto"}
        ]
        scheduler.config.first_hour=7;
scheduler.config.last_hour=19;
scheduler.config.hour_date="%h:%i%A";

        //scheduler.locale.labels.section_location="Location";
        //scheduler.config.details_on_create=true;
        //scheduler.config.details_on_dblclick=true;


     scheduler.createUnitsView("unit","section_id",sections);
scheduler.locale.labels.unit_tab = "Radiologist"
        scheduler.locale.labels.section_custom="Assigned to";
        scheduler.config.details_on_create=true;
        scheduler.init('scheduler_here',null,"week");
        scheduler.load("php/ir_events.php?uid="+scheduler.uid());

        //work week
        scheduler.date.workweek_start = scheduler.date.week_start;
        scheduler.templates.workweek_date = scheduler.templates.week_date;
        scheduler.templates.workweek_scale_date = scheduler.templates.week_scale_date;
        scheduler.date.add_workweek=function(date,inc){ return scheduler.date.add(date,inc*7,"day"); }
        scheduler.date.get_workweek_end=function(date){ return scheduler.date.add(date,5,"day"); }

//decade
        scheduler.date.decade_start = function(date){
            var ndate = new Date(date.valueOf());
            ndate.setDate(Math.floor(date.getDate()/10)*10+1);
            return this.date_part(ndate);
        }
        scheduler.templates.decade_date = scheduler.templates.week_date;
        scheduler.templates.decade_scale_date = scheduler.templates.week_scale_date;
        scheduler.date.add_decade=function(date,inc){ return scheduler.date.add(date,inc*10,"day"); }
        


        var dp = new dataProcessor("php/ir_events.php");
        dp.init(scheduler);

    }
</script>

<body onload="init();">
    <div id="scheduler_here" class="dhx_cal_container" style='width:100%; height:100%;'>
        <div class="dhx_cal_navline">
            <div class="dhx_cal_prev_button"> </div>
            <div class="dhx_cal_next_button"> </div>
            <div class="dhx_cal_today_button"></div>
            <div class="dhx_cal_date"></div>
            <div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
            <div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
            <div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
<div class="dhx_cal_tab" name="unit_tab" style="right:280px;"></div>
<div class="dhx_cal_tab" name="workweek_tab" style="right:280px;"></div>
            <div class="dhx_cal_tab" name="decade_tab" style="right:345px;"></div>

        </div>
        <div class="dhx_cal_header">
        </div>
        <div class="dhx_cal_data">
        </div>        
    </div>
</body>
Answer posted by Alex (support) on Oct 22, 2009 03:24

There are following issues in your code:

1) both unit_tab and workweek_tab have teh same right offset:

<div class="dhx_cal_tab" name="unit_tab" style="right:280px;"></div> 
<div class="dhx_cal_tab" name="workweek_tab" style="right:280px;"></div> 

try to use 

<div class="dhx_cal_tab" name="unit_tab" style="right:420px;"></div> 
<div class="dhx_cal_tab" name="workweek_tab" style="right:280px;"></div> 

2) the code is called after  scheduler.load("php/ir_events.php?uid="+scheduler.uid()); and before mut be placed into onTemplatesReady event handler. And this handler should be set before init command. Please, see the sample dhtmlxScheduler/samples/sample_workweek.html