I want to dynamically add an overlay to the cells within a swimlane \nIt is working fine if the swimlane is already expanded in which case the overlay on the children cells is visible\nBut when I try doing the same in the FOLD_CELLS or the CELLS_FOLDED event handlers, then I do not get any javascript error but the overlay is not display also.\nPlease assist.

asked 15 Feb '12, 01:34

Tushar's gravatar image

Tushar
36117
accept rate: 0%


This works for me. Here is an example:

\n
var v1 = graph.insertVertex(parent, null, 'Hello,', 20, 20, 100, 50);\nv1.collapsed = true;\nvar v2 = graph.insertVertex(v1, null, 'World!', 20, 10, 60, 30);\n
\n

If I expand v1 using the following listener I see the message as expected on v2:

\n
graph.addListener(mxEvent.CELLS_FOLDED, function(sender, evt)\n{\n  var cells = evt.getProperty('cells');\n  if (cells != null)\n  {\n    var child = graph.getModel().getChildAt(cells[0], 0);\n    graph.setCellWarning(child, 'test');\n  }\n});\n
link

answered 16 Feb '12, 09:03

Gaudenz's gravatar image

Gaudenz
80.1k1310
accept rate: 39%

Thanks, I am able to add the overlay now but I am not able to add the mouse over event listener to the overlay element (image) \nI also want to attach a click event to the cell element which I am not able to do in this case

\n

My code is\n\n var cellEl = $(state.shape.node);\n cellEl.addEvent('click', mxUtils.bind(this, function() {\n //manage click event\n }));

\n
    $(state.overlays[0].node).addEvent('mouseover', mouseOverFn);\n
\n

\nPlease guide how I can add the mouseover event to the overlay icon and the click event to the vertex element

(17 Feb '12, 01:53) Tushar
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
×25
×10

Asked: 15 Feb '12, 01:34

Seen: 1,682 times

Last updated: 17 Feb '12, 01:53