0

I am using DevExpress and Angular 10. I would like to drag a person into an appointment. It works if I drag it beneath the

tags. If I drag an item into to appointment but on the p html tags, I don't know how to get the ID of the appointment.

the html:

As you see, the yellow part is the wanted ID. enter image description here

As mentioned before, if I drop the item beneath the p tags: enter image description here

(the red spot), I can get the ID. Otherwise I don't.

the app.component.ts:

e.addEventListener('drop', event => {
  let appointmentId = parseInt(event.target.parentElement.parentElement.id.split('--')[0]);
}

I already tried working with event.target.parentElement or event.srcElement.offSetparent but nothing works in both situations. How can I make sure that the drop event sees the appointment as the 'head/main' one to get the ID?

Kind regards

Sarah De Cock
  • 87
  • 1
  • 2
  • 10
  • I would set a breakpoint inside the listener, and then explore the whole event object and check if there is the desired id. – Codigo Morsa Jul 16 '20 at 15:13
  • Yes the desired id is there if a drag into the red spot via ```let appointmentId = parseInt(event.target.parentElement.parentElement.id.split('--')[0]); ``` But if I drag into the text of the appointment, I cannot get the ID the same way. I'm searching for a way to set the div I want as 'main' element to take the ID of in a drop event. Regardless of the other elements that are inside the div.. – Sarah De Cock Jul 16 '20 at 19:49

0 Answers0