Drag&Drop function in mappView


is there a way how to effectively use the drag’n’drop function in mappView ?

My use case is as follows: imagine a situation where you have a stack of products, and you need to move them to their places, see fig.1. I know how to drag and drop them, but I have problems with moving them back to their inital position.


I am using event bindings which set the content visible/invisible according to what was dropped where.
Problem is when you have many products and want to move them randomly, the number of eventbindings rises to an unwanted number. There must be some easier solution…

Also I need to have some memory in the backend to know which product was where, but I suppose I could use some combination of session variables and triggers for that.

Also when you use the content loading method, you cannot drag the new loaded content to some other content somewhere else - can you even do that ?

Thank you for any advice.

I am including a test project I made, the green rectangle represents position one of the grid, so you can imagine how many content objects there would be in total if I were to use it like this for all products.

TestDragAndDrop.zip (116.8 KB)

Hello Jan Fikejzl;

Judging from your comment, I assume that you want to use it to represent in mappview the stack of products (X number of product). In this case, in place of using drag and drop, it may worth a try to use paper widget and using the transform propierties.

Each product could have it’s own id, and then using the translate transformation to move them.

In the end my colleague Rudolf Síla and I have created a working solution.

Little background - mappView and its drag’n’drop function is not a “true” drag’n’drop. You just get the events, that something was dragged and dropped somewhere. One piece of content cannot live in more than one location (IDs and unique naming and all of that…).

Our solution works like this, when you take a product from a queue we load its ID (some property you can define yourself) so we know which product is being moved, when we drop the product at the desired place, using the widget event on drop, we just load the respective product into the image (each place in the queue or in the workplace is an image you can load into).
You can also have some additional info about the products in a structure in code, no problems there.
For every product you would need 3 eventbindings, which is quite all right :slight_smile:

Our initial proposition was using the visible properties and just having each of the product images stacked on top of each other and changing it to visible true when on drop was triggered - that was no bueno because it leads to enormous amounts of bindings and you cannot easily expand with more products.

I am including a working project. If you were to complete it, you would need to copy the images, so they are at each position you want and than you copy the bindings and change them so they work altogether.

DragDrop.zip (280.6 KB)