Limiting Drag and Drop

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
jetblacklb
New User
Posts: 6
Joined: Tue May 08, 2018 12:26 pm
First Name: Joe
Last Name: Turocey
Company Name: Banyan Air Service
State / Province: Florida
Country: United States
Contact:

Limiting Drag and Drop

Post by jetblacklb »

I have a screen that has two subfiles on it and I allow the user to drag data from subfile 2 to subfile 1 using the drag and drop feature. Is there a way I can limit what lines the user can drag and drop from subfile 2. For example lets say I have 5 lines in subfile 2 and I only want the user to be able to drag lines 1,3, and 5. Lines 2 and 4 would be blocked from dragging. Is there a way to do this? I have tried using the "allow drag" property but couldn't get it to work. Any help would be appreciated.

Joe
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Limiting Drag and Drop

Post by Scott Klement »

Hi Joe,

The "normal" way of doing drag and drop (or, at least, the one I typically see) is by submitting control to the RPG (or Cobol, Node.js, PHP, whatever you're using) program. So, when the "drop" happens, the RPG gets control and re-writes the subfiles to have the new row in the appropriate spot.

Of course, it is also possible to do this with JavaScript using the ondragXXXX/ondrop JavaScript events.

In either case, it is your code that is rewriting the screen to move the element from one place to another. We do show an animation of the element being dragged, but it's not actually moved to the new widget until your code updates things.

With that in mind, one way to simply block drag/drop is to not move it. Your code could pop up a message on the screen saying "sorry, you can't drag that row" (or whatever makes sense) and then not move it, causing the row to remain where it started.
jetblacklb
New User
Posts: 6
Joined: Tue May 08, 2018 12:26 pm
First Name: Joe
Last Name: Turocey
Company Name: Banyan Air Service
State / Province: Florida
Country: United States
Contact:

Re: Limiting Drag and Drop

Post by jetblacklb »

Thanks for your reply Scott.

That's the way I am doing it now but I was hoping there would be a way to block certain lines from even being grabbed and prevent the animation of element being dragged from happening.

Joe
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests