Using ext_matrix.js and scheduler.config.event_duration

Hi,

I am using ext_matrix.js in order to display an event to take up the entire cell for which it was entered on. However, when I go to create an event, I would really like the following two lines to still work;

scheduler.config.event_duration = 480; scheduler.config.auto_end_date = true;
What would I need to do to make this happen?

Hello,

What mode are you using: matrix, timeline? If you double click cell in the timeline mode event start and end dates would be set automatically to fit that cell.

Kind regards,
Ilya

I am using timeline mode.

When the event is first created, it adheres to the rules defined by;

scheduler.config.first_hour = 7; scheduler.config.last_hour = 22; scheduler.config.limit_time_select = true;
Which is evident in the attached picture. The start date is set at 07:00. However, the end date is set to a full 24 hours later, ending at 07:00 the following day.

If I change the start time to 07:05, it automatically sets the end time to 480 minutes later - at 15:05 on the same day. This is achieved by the following rules;

scheduler.config.event_duration = 480; scheduler.config.auto_end_date = true;

Question is; how can I make it so that when the event is first created it abides by the rules in the second code listing above straight away (without me having to change the start date).

Thanks,

Mike


Hello,

When you double click cell in timeline view event is created with start and end dates which would fill whole cell. This is default behavior.

What you can do in such case is to manually set end date for new events in timeline view in the onBeforeLightbox event.

Kind regards,
Ilya

Which value of scheduler.config.time_step you are using?

The event_duration must be equal to time_step*N, or it will produce time values which can’t be selected through time picker.

@Ilya I figured this was what was occurring. Any examples on how I could use this event to set appropriate end time to that set by

scheduler.config.event_duration = 480;

@Stanislav I am not using that property - so it is defaulting to 5 minute increments. So I am OK there. I think Ilya is right; the default behavious for ext_matrix.js is to set the end time automatically to + 24 hours after the start time. If I use that event he mentions, I should be able to override it. But thanks for mentioning that config parameter - I didn’t want 5 minute increments!!!

Mike

Hi,

I still need help with this one. As soon as an event is created (by double-clicking on an empty cell), I would like the start and end times set to default values.

What code is required to achieve this?

Thanks!

scheduler.attachEvent("onEventCreated", function(id,e){ var event = scheduler.getEvent(id); event.start_date = some_processing(event.start_date); event.end_date = some_processing(event.end_date); return true; });

Thanks,

Using your code as a guide, I coded;

scheduler.attachEvent("onBeforeLightbox", function (id){ var event = scheduler.getEvent(id); event.end_date = scheduler.date.add(event.start_date,(scheduler.config.first_hour*60+scheduler.config.event_duration),"minute"); return true; });