Page 1 of 1

[INFO REQ] lwc drag context.element is empty

Posted: Thu Dec 08, 2022 12:26 pm
by frederick45

Hi, i create a new dragHelper in my LWC.
the dragstart part works fine, but in my drag part, context.element is empty

                
listeners: { dragstart: ({context}) => { context.task = this.UnplannedGrid.getRecordFromElement(context.grabbed); this.UnplannedGrid.store.remove(context.task); //console.log('context.grabbed:'+JSON.stringify(context.grabbed)); //OK //console.log('context.task:'+JSON.stringify(context.task)); //OK }, drag: ({event, context}) => { console.log('task:'+JSON.stringify(context.task)); //OK //{"id":"a105r000001GRRNAA4","start":"2022-11-21T08:00:00+01:00","recurrenceCombo":"none","name":"VI-000003","finish":"2022-11-21 17:00:00","duration":"9"} console.log('schedule.isHorizontal:'+this.scheduler.isHorizontal);//OK //true console.log('context.element JSON:'+JSON.stringify(context.element));//KO empty {} //{}

Re: [INFO REQ] lwc drag context.element is empty

Posted: Tue Dec 13, 2022 11:16 am
by joakim.l

Hi!

I can't immediately see whats causing the missing element property. Please provide a test case in which it can be reproduced.

Hovever, you shouldn't need to remove the dragged record from the source grid on drag start. That should be done by DragHelper when drag is complete.


Re: [INFO REQ] lwc drag context.element is empty

Posted: Tue Dec 13, 2022 11:56 am
by frederick45

i found the solution
BR