Author Topic: Differentiating between 2 drag sources  (Read 2466 times)

WynApse

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 17
    • View Profile
Differentiating between 2 drag sources
« on: December 06, 2019, 04:25:42 am »
I have 3 grids.
One is the main display.
The second is employees, the third projects.

I have a clsDnD defined for dragging from Projects to the main, and the accept has the clsDnD in it and that works fine.

Now I want to setup a clsDnD in the Project grid and be able to ALSO drag from Projects to main.

I'm not seeing how to differentiate between the two drag sources, or even if how to add a second clsDnD to the 'accept' on the destination.

Thanks!

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Differentiating between 2 drag sources
« Reply #1 on: December 06, 2019, 10:43:28 am »
dropModel.accept: Its syntax is same as css selectors. More than one source can be defined by separating corresponding classes with a comma.

Origin of drag source can be identified from the grid property of Drag object. And Drag object can be obtained from ui.helper in isDroppable and drop callbacks of dropModel.

https://paramquery.com/pro/api#option-dropModel

https://paramquery.com/pro/api#method-Drag

https://www.w3schools.com/cssref/css_selectors.asp

WynApse

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Differentiating between 2 drag sources
« Reply #2 on: December 06, 2019, 08:48:23 pm »
Awesome, thanks!

I thought maybe I could put in multiple drop classes and have them comma-separated, but it was near the end of the day, and didn't want to wait until this morning to try it and then find out I needed to ask, so just posted to be proactive.