Customize scheduler step on event creation


I’m beginning with dhtmlx scheduler. I’m searching if it is possible to do the following configuration for my scheduler :
I have a timeline displaying the weeks as xunits and customized stuff as sections.
What i want to do is when i create an event, it will step from week to week on dragging (you can’t create an event which will begin / finish in the middle of the week).

I apologize if this question has already been asked, but i haven’t found anything about it (and i don’t really know what key words to search for).


Check … ecellwidth


thanks for your advice. I have set the round position attribute, it works fine when i create the event (it is set to the full week), but I still can extend it as I want, it doesn’t fit the next week when i’m extending it to the right. I maybe have made a mistake in my timeline creation as I’m really newbie, here is the code :

name: “timeline2”,
x_unit: “week”,
x_date: “#%W”,
x_step: 1,
x_size: 8,
x_start: 0,
x_length: 8,
y_unit: sections,
y_property: “section_id”,
dy: 25,
x_unit: “month”,
x_date: “%F”

I saw there was some events like onBeforeDrag and onBeforeEventChanged. I will take a look at it to see if it is possible to manage something with it.

i’ve made a test example with your configuration, everything seems working correctly. Check the attachment (197 KB)

Please remove round_position setting, and add code like next

scheduler.attachEvent("onBeforeEventChanged", function(ev){ ev.start_date =; ev.end_date =; return true; })

it will automaically shift dates to start of week after any edit or create operation.

Thanks to you both.

@Aleksandr : I have run your example and it works just as i want. I will investigate to find why it doesn’t work in my scheduler, i must have done something wrong.
@Stanislav : I had come up with a solution like this (except i didn’t knew the week start function so i had rewrote it…). I will take this solution if i can’t find why the round position doesn’t work.

Thanks for the solution, i wills try to find what was my mistake in the first solution, otherwise i will use the events.

To sum up if anyone has this issue :
I have updated the version of the scheduler and now it works fine with the round_position attribute in the timeline creation in week view.
So i have kept this solution for the week view and added the events previously described by stanislav on the month and year views to create week events.

Thanks for your help.