scottdurow / power-drag-drop

MIT License
131 stars 28 forks source link

How to retrieve the drop item's value and filter item at target zone? #61

Open SOMSGH opened 8 months ago

SOMSGH commented 8 months ago

Hi Scott and experts! I'm creating a canvas app using this solution, I have 2 main questions:

  1. How do you retrieve the selected (dropped) item value ? e.g. I connect mater zone to a dataverse table, I want to get the ID value from the item that I dropped to target zone, how can I achieve it? normally, at OOTB gallery control I can use gallery.selected.columnname.value, but here I'm struggling to find the correct property of the pcf control..
  2. How can you filter the target zone items? Thanks in advance!
craigmday commented 4 months ago
  1. To get the selected (dropped) item, you should be able to read the [DragandDropControlName].DroppedId property. This should give you the value associated with the Id column in your Drag and Drop control.
  2. I'm not sure how you could go about filtering the target zone items because it is going to display items based on their DropZoneId, which would be updated after they are dropped. In my solution, I am actually patching a record in a different table when I drop, because I need to be able to move the original item back to where it was (so it can be dropped in multiple places). You may be able to do something along those lines in order to filter out what you don't want to see.