Hello

I also have a problem while trying to remove cloned cells. I found a similar thread http://forum.jgraph.com/questions/2575/remove-cells-from-grapheditor but no solutions has been discussed. Basically the code I am using is:

//clone vertex
Object clone=((mxCell)vertex).clone();
//add to graph
getGraph().insertVertex(parent, id, clone.getValue(), ...)
//at some point afterwards I want to remove this cloned cell again
getGraph().removeCells(new Object[]{clone});

... but without any success. (on the other hand I was successfully removing non-cloned cells with the removeCells() function.)
Thank you for help !
Marian

asked 06 Dec '12, 14:41

marian's gravatar image

marian
1516
accept rate: 0%

edited 06 Dec '12, 14:51

Actually I am confused. Seems like there is no problem removing a cloned cell in a different instance. so I have to look more close what is going on here... thanks anyway

(06 Dec '12, 15:05) marian

ok, my fault. I passed the wrong object to the remove function... sorry

(06 Dec '12, 15:45) marian

You're not adding the clone to the graph. The value of the cell is the user object associated with the cell. insertVertex returns the cell that was added, pass that into removeCells instead.

link

answered 06 Dec '12, 17:45

David's gravatar image

David
4.9k21831
accept rate: 47%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×194
×6
×3

Asked: 06 Dec '12, 14:41

Seen: 940 times

Last updated: 06 Dec '12, 17:45