Setting new event duration in week view

I have successfully implemented day view and week view with DHTMLX Scheduler .NET. When double clicking empty cells in day view, scheduler creates new event with duration of 2 hours, just like intended. But when double clicking empty cell in week view scheduler creates new event with duration of 24 hours, which is not suitable for me. That is because our use case for this scheduler is following:

First user creates events for one day only. After that, events for that day are duplicated for desired number of other days. Duplication is made by server software. After that user should be able to modify these duplicated events. But there is also “Collision” extension in use so user cannot create overlapping events.

Because of that use case, editing events in week view is quite impossible because “Collision” extension prevents creating events with 24 hours duration. And it seems that week view creates 24 hour duration events by default.

I suspect that there is something wrong with my timeline generation. Here is my day and week timeline creation:

      protected TimelineView _GenericTimeline(string name, IEnumerable data)
        {
            var timeline = new TimelineView(name, "entity_Id");
         
            timeline.Dx = 149;
            timeline.AddOptions(data);
            timeline.Dy = 38;

            timeline.EventDy = timeline.Dy - 5;
            timeline.FolderDy = 114;
            timeline.FolderEventsAvailable = false;
            timeline.ResizeEvents = false;
            timeline.SectionAutoheight = false;
            timeline.RenderMode = TimelineView.RenderModes.Bar;
            return timeline;
        }

        protected TimelineView _CreateWeekTimeline(IEnumerable data)
        {
            var unitsWeek = this._GenericTimeline("Week", data);
            
            unitsWeek.X_Step = 1;
            unitsWeek.X_Unit = TimelineView.XScaleUnits.Day;
            unitsWeek.X_Size = 7;
            unitsWeek.X_Length = 1;
            
            unitsWeek.Label = "Week";
            unitsWeek.TabStyle = "left: 199px;";
            unitsWeek.TabClass = "dhx_cal_tab_last";
            return unitsWeek;
        }

        protected TimelineView _CreateDayTimeline(IEnumerable data)
        {
            var unitsDay = this._GenericTimeline("Day", data);
            unitsDay.X_Step = 2;
            unitsDay.X_Length = 12;
            unitsDay.X_Size = 12;

            unitsDay.Label = "Day";
            unitsDay.TabStyle = "left: 38px;";
            unitsDay.TabClass = "dhx_cal_tab_first";
            return unitsDay;
        }

I suspect that using X_Step = 1 and X_unit = Day for week view is the culprit, but I really cannot find any work around.

Also I am setting following configurations in creating of scheduler:

            scheduler.Config.container_autoresize = false;
            scheduler.Config.auto_end_date = false;
            scheduler.Config.multi_day = false;
            scheduler.Config.time_step = 30;
            scheduler.Config.event_duration = 120;
            scheduler.Config.full_day = false;

As it can be seen I am setting event_duration = 120 which work perfectly for day view but not for week view. Is there something I have missed or is this just feature that is not available in scheduler?

Hi,
timeline allocates new event for a full column width. You can change the duration of a newly created event with a JS api, for example:

scheduler.attachEvent("onEventCreated", function(id){ var mode = scheduler.getState().mode; if(mode == "Week" && scheduler.config.event_duration){ var ev = scheduler.getEvent(id); ev.end_date = scheduler.date.add(ev.start_date, scheduler.config.event_duration, "minute"); } });
docs.dhtmlx.com/scheduler/api__s … event.html
docs.dhtmlx.com/scheduler/api__s … state.html