Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

click event on connection not working #27

Open
priyankapothala opened this issue Apr 11, 2017 · 7 comments
Open

click event on connection not working #27

priyankapothala opened this issue Apr 11, 2017 · 7 comments

Comments

@priyankapothala
Copy link

priyankapothala commented Apr 11, 2017

jsPlumb.bind("click", function(connection, originalEvent) {
alert('clicked on a connection');
});

click event is not triggered.

@sporritt
Copy link
Member

the event is "click". your example shows you binding to "connection".

@priyankapothala
Copy link
Author

Corrected the code above.
I even tried binding click event in the following way. It doesn't seem to work either

var instance = jsPlumb.getInstance();
instance.bind("connection", function (info) {
var connection = info.connection;
connection.bind("click", function(connection, originalEvent) {
alert('clicked on a connection');
});
connection.addOverlay(["Label", {
label: "dummy-connection"
id: "label",
location: 0.20,
events:{
click:function(labelOverlay, originalEvent) {
console.log("click on label overlay for :" + labelOverlay.component);
}
}
}]);
});

Label click event is also not triggered

@sporritt
Copy link
Member

can you reproduce in a jsfiddle?

@priyankapothala
Copy link
Author

Here is the jsfiddle link

https://jsfiddle.net/priyankapothala/u7cuymzk/7/

@abhirocks550
Copy link

@priyankapothala I have created jsfiddle with an event on the connection.

https://jsfiddle.net/abhirocks550/j165uafc/

I hope this will help.

@fatima-gloqal
Copy link

@abhirocks550 can you share with us the solution you have made please, the jsfiddle you have shared is not working , thank you

@agarwalsanchi
Copy link

Hi @abhirocks550
I need your help

  1. jsPlumbInstance.on(document.querySelectorAll(".jtk-connector"), "dblclick", function (e) {
    // alert("double click");
    if (CurrentLevel == 2) {
    onBlockConnectionDoubleClicked(CurrentConnection);
    }
    });

i have used .on to add event dblclick on all connectors with clas name "jtk-connector"

actually i need ot pass the clicked conn details inside method "onBlockConnectionDoubleClicked"

how to achieve this?
used e.target or tried this leyword but not able to get details because svgelement has nested path.
e.target.nodename is returning path that is inside svg.

how to find out which conn is clicked.

  1. instance.bind("click", function (component, originalEvent) {
    alert("click!")
    });

tried this too but not working

@sporritt sporritt transferred this issue from jsplumb/jsplumb Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants