Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by mahesh on Oct 23, 2009 23:20
open dhtmlx forum
Use of select box to determine time duration needed to book event given start time

I am trying to figure out how to use the key value to map to an event time length, and then on event change update the end procedure time to be time start + event time length based on select list.

<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"}
    ];
        var procedure=[
        {key:1, label:"pulmonary arteriogram"},
        {key:2, label:"spine biopsy"},
        {key:3, label:"chest tube"},
        {key:4, label:"biliary drainage"},
{key:5, label:"chest biopsy"}
    ];
scheduler.locale.labels.workweek_tab = "W-Week"
        scheduler.locale.labels.decade_tab = "10-days"
        

        //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:"prolength", height:23, type:"select", options:procedure, map_to:"section2_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";

    
Answer posted by Stanislav (support) on Oct 26, 2009 10:15
You can use something , similar to the next

scheduler.attachEvent("onEventChaged",function(id){
            var ev = scheduler.getEvent(id);
            if (ev.section2_id == some)
                 ev.end_date = scheduler.date.add(ev.start_date,30,"minute");
})
Answer posted by mahesh on Oct 27, 2009 00:10
Can you possibly elaborate.  I do not understand how to pass the variable procedure key value which then needs to map to a time in hours/minutes  to the event selection end time.
Answer posted by Benjamin on Oct 27, 2009 01:46
Hello there Stanislav...

Seems like Mahesh is looking for equal think like me here: index.shtml?cat=kb&page=2&q=12274
But why are you opening that much threads nahesh with same questions ?!?
Answer posted by Stanislav (support) on Oct 28, 2009 11:14
The sample , which illustrates the desired use-case can be checked at
            http://dhtmlx.com/docs/products/kb/index.shtml?cat=recent&q=12274