1
1

How can I set a specific cell in a graph to be selectable and some others not ?

asked 21 Aug '11, 10:49

alexost's gravatar image

alexost
1113
accept rate: 0%

edited 20 Jun '14, 16:05

David's gravatar image

David
4.9k21831


Overriding mxGraph.isCellSelectable is the general idea. For a specific suggestion, you could add a selectable style to all cells as follows:

mxGraph.prototype.isCellSelectable = function(cell)
{
  var state = this.view.getState(cell);
  var style = (state != null) ? state.style : this.getCellStyle(cell);

  return this.isCellsSelectable() && !this.isCellLocked(cell) && style['selectable'] != 0;
 };

And then use the selectable style as follows:

var v1 = graph.insertVertex(parent, null, 'Hello,', 20, 20, 80, 30, 'selectable=0');
link

answered 23 Aug '11, 05:35

Gaudenz's gravatar image

Gaudenz
80.1k1310
accept rate: 39%

edited 20 Jun '14, 16:11

David's gravatar image

David
4.9k21831

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:

×228
×66
×13

Asked: 21 Aug '11, 10:49

Seen: 4,117 times

Last updated: 20 Jun '14, 16:11