search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Prevent drag event

Asked by Sara
8 years ago.

Hi, I would like to prevent to drag and resize event in different cells for each resource.
My solution requires that for Mr. X the job time enabled is between 9:00 AM and 4:00 PM instead for Mr. Y the job time is between 8:00 AM and 1:00 PM.
I need to prevent to drag and resize event for each worker depending on their respective working time.
Is there a javascript function (or postback event) that I can use for this feature?

Comment posted by Davide
8 years ago.

I tried to use this javascript event

function eventMoving(args) {
....TODO....
}
Is possible to check in this event if the start (or end) property is business or not?

Thanks

Answer posted by Dan Letecky [DayPilot]
8 years ago.

> Is there a javascript function (or postback event) that I can use for this feature?

EventMoving event (https://doc.daypilot.org/scheduler/event-moving-customization/) is a good way to implement it. Just set

args.allowed = false;

if you want to forbid the current position. You can also display a label with more details:

args.right.enabled = true;
args.right.html = "This position is not allowed because .... ";

> Is possible to check in this event if the start (or end) property is business or not?

You can get this information using the cells API:

dp.cells.find("2016-04-03", "A")[0].properties.business
Comment posted by Sara
8 years ago.

Thank you Dan,
the function dp.cells.find("2016-04-03", "A")[0].properties.business
is exactly what I needed!!!

Thank you again
Sara

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.