PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WB2x] Looper DnD possibilities to move looper items
[WB2x] Looper DnD possibilities to move looper items
Débuté par Peter Holemans, 03 mai 2016 13:41 - 3 réponses
Posté le 03 mai 2016 - 13:41
Hi,

I'm not the sharpest in frontend javascript but was wondering if (e.g. with the help of jQuery libraries) it would be possible to implement a drag and drop solution to move items within a looper from position. E.g. drag item 2 from to looper to in between item 5 and 6. While dragging, the looper would display a box or line where the insert would take place if one dropped the item.

Something like shown in this example.

Any ideas or examples would be highly appreciated.

Best regards,

Peter Holemans
Posté le 03 mai 2016 - 14:57
Hi Peter,

I haven't tried, but if we are talking about a non editable looper, I would try and code that without jquery, just in wlanguage. This is what I would do:
- on top of my looper elements, I would add a transparent control (image by example), covering the whole looper
- I would add the click down and click up process to that element
- in the click down process, I would start a timer (by example 1/10 s), and in the click down process I would stop that timer. This would differentiate between a regular click (down and up are in less than a 1/10 of a second) and a drag
- in the timer process, I would make an extra cell visible, containing the same control than the looper, and with the data of the current line copied in it. This cell position would be calculated based on the mouse position, of course, inside the area of the looper
- in the click up process, I would again find which element has been clicked up, and replace/move the looper accordingly.

Of course, it would also be possible to move everything WHILE dragging, in the timer process.

AFAIK, no jquery required...

Best regards
Posté le 03 mai 2016 - 15:54
Hey Fab,

Thanks for your input. I'll give it a try and will let you know...

Cheers,

Peter
Posté le 23 janvier 2021 - 09:38
Hi Peter,

I am actually looking for the same kind of solution. Did you find any working fix for moving looper items?

Are you willing to share?

Regards,
Tim Korssen