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

renderNode sample code #268

Open
bharath123456789 opened this issue Sep 14, 2020 · 0 comments
Open

renderNode sample code #268

bharath123456789 opened this issue Sep 14, 2020 · 0 comments

Comments

@bharath123456789
Copy link

bharath123456789 commented Sep 14, 2020

Hi, I am trying to use renderNode method, with that in foreignObject, I am trying to call the onClick event but it's not being caught, can anyone please help me on it, below is the code I am using.

renderNode = (nodeRef, data, id, selected, hovered) => {
    return (
      <g className="shape">
        {!selected ? null : (
          <foreignObject x="-77" y="-77" width="154" height="77">
            <i
              className="dls-icon-edit"
              onClick={() => console.log('onClick console')}
              style={{
                padding: '20px',
                fontSize: 20,
              }}
            />
          </foreignObject>
        )}
        <use
          className={`node ${selected ? 'selected' : ''}`}
          x="-77"
          y="-77"
          width="154"
          height="154"
        />
      </g>
    );
  };

Screen Shot 2020-09-14 at 2 52 47 PM

I am able to see that pencil icon, but if I click on it I am not getting the console log.

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

1 participant