Gojs drop with kanban


#1

Hi,
I’m working with the kanban example,
and I need to read the droppable element (key,text…)

mouseDrop:function(e,grp){

var ok=grp.addMembers(grp.diagram.selection,true);
How can I read the key of the droppable element?
Thanks in advance.


#2

If you are talking about within the mouseDrop function, grp.diagram.selection will contain the set of copied parts that had been dropped. You can iterate over the set and look at the data.

grp.diagram.selection.each(function(p) {
  var data = p.data; // p is a Part, could be a node or link
  ...
});

#3

OK now it’s correct,
Now I want to read the key of the target lane.

Thanks in advance


#4

You can look at the properties on the object that is the value of Node.data. One of those properties is the key.


#5

OK now it’s correct,
Now I want to read the key of the target lane.

Thanks in advance.


#6

Ah, sorry, I misread your question.

If p is a Part, then p.containingGroup will tell you the Group, a.k.a. “lane”, that the part is in.
https://gojs.net/latest/api/symbols/Part.html#containingGroup

Remember that the value may be null if the part isn’t a member of a group.


#7

OK now it’s correct,

Thanks a lot.


#8

Hi,
Another question:
Is it possible to have the event of double click (or right click) on a rectangle ?
Like this I can open a window and see the data of my rectangle.
Thanks in advance.


#9

Yes, set the GraphObject.doubleClick or contextClick event handler.
https://gojs.net/latest/intro/events.html#InputEvents


#10

Ok it runs,
Thank you very much