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

Not allowed to add event on same place after Deleting the event

Asked by Nirav Upadhyay
7 years ago.

Hi,

I am deleting the event using my custom method on button click as below.
let shiftToDelete = dp.events.find(this.selectedEventId);
dp.events.remove(shiftToDelete);

Most of the time on the same place (same start and end time) it doesn't not allow me to add events, if i add event on other timeslot then it is successful.

Somehow after delete operation DayPilot scheduler doesn't fire any event for that particular time duration where the event was deleted.

Regards,
Nirav

Comment posted by Dan Letecky [DayPilot]
7 years ago.

It looks like there is a problem with the checksum of the events array. It looks like it's not being updated properly and the subsequent change is not detected. Please let me check the issue.

Comment posted by Anonymous
7 years ago.

Thanks Dan!!!

We tried to debug internal daypilot control - We have Delete button as a separate which delete the events in control. We just update the dp.events to update the data. When we are inserting new record, DayPilot initialize range and rangeHold when adding new events for specific range. Because DayPilotSchedulerControl.Range is null, it is not allowing to add event for the range which is deleted.

Hoping for some fix in DayPilot control in that.

Thanks,
Devendra.

Comment posted by Dan Letecky [DayPilot]
7 years ago.

Just to make sure:

1. You are using Angular 2, right?
2. You are deleting events using events.remove()
3. When you try adding a new event are you able to create a time range selection using mouse (or does it fail at this point)?
4. If you are able to create the time range selection, how do you add new events? Using dp.events.add() or by adding the event to [events] object?

Comment posted by Anonymous
7 years ago.

1. You are using Angular 2, right? - Yes. Angular2.
2. You are deleting events using events.remove() - we are deleting event using dp.events.list.splice(shiftIndex, 1);3. When you try adding a new event are you able to create a time range selection using mouse (or does it fail at this point)? - Yes. we are trying to add it with mouse. It is actually blocking for that range where it has initially created shifts. I
4. If you are able to create the time range selection, how do you add new events? Using dp.events.add() or by adding the event to [events] object? - yes using dp.events.add(event);

It looks like a problem with dayilot control rangehold and range object. The range object is coming as null when we are trying to add new events in that area. As it is null, it is not triggering TimeRange event.

Comment posted by Dan Letecky [DayPilot]
7 years ago.

Unfortunately I haven't been able to reproduce the issue. Would you be able to post a sample that reproduces the problem (or send it to support@daypilot.org)?

Answer posted by Kavya Shetty
7 years ago.

Got this to work with following code change:-
let shiftToDelete = dp.events.find(this.selectedEventId);
dp.events.remove(shiftToDelete);
dp.clearSelection();

But is it necessary to call clear selection on every remove.
Note: We are using version 2522 for our project.

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