Our pure JavaScript Scheduler component


Post by AswathyM »

getDateFromDomEvent function is not returning the exact date of the coordinate where the event is dropped if an event is already present in the same location. Instead it returns some date from start of the day.

I am trying to drop a row from a custom grid(not the brytnum) using html drag-drop events. Using html drop event I am trying to get date. It works in empty part of scheduler. It shows different date if dropped on top of an existing event.

I need the exact date so that I can perform validations before creating the event.
Could you please help ?

Post by pmiklashevich »

Ok, seems I'm able to reproduce. Thanks for the report. I'll check and get back to you soon

Pavlo Miklashevych
Sr. Frontend Developer


Post by pmiklashevich »

Ticket to fix getDateFromDomEvent here: https://app.assembla.com/spaces/bryntum/tickets/8128
Meanwhile you can use getDateFromXY function directly. For example:
scheduler.getDateFromXY([event.x, event.y], null, false);

Pavlo Miklashevych
Sr. Frontend Developer


Post by AswathyM »

Now I am able to get the date and resource and add the event. I need to validate if an event is already present in same location before adding this event. For this, I am trying to use getEventsForResource and getEventsinTimeSpan methods.

getEventsForResource method returns all events of the resource
getEventsinTimeSpan method returns all events of the same time but for all resources.

Do we have any method which will return all events of a resource in same time span (combination of both)?

Post by pmiklashevich »

No, we don't have such a function. But you can easily implement it yourself. getEventsInTimeSpan returns an array of events. You can use JS filter function to get only those you need. For example, please open our Basic demo and run in console:
events = scheduler.eventStore.getEventsInTimeSpan(new Date(2017, 0, 1, 8), new Date(2017, 0, 1, 12));
karenEvents = events.filter(event => event.resource.name == "Karen");
karenEvents.forEach(event => console.log(event.name));

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply