I'm overriding the default VertexHandler to add some custom UI tools, per the tools example. I'd like to read some attributes of the user object during vertexHandler.prototype.redraw(), but I can't figure out how.

I thought I had a handle on the cell with this.state.cell - I'm using this to perform other actions on the cell, like removing it. However, when I call this.state.cell.getValue("key"), I get undefined. When I kick this out to console.dir, I can see that state.cell.value has attributes listed.

Any thoughts?

vertexHandler.prototype.redraw = function () {
    console.log("vertexHandler > redraw called.");

    var dx = this.state.x + 70;
    var dy = this.state.y + this.state.height + 50;
    $("#mx-menu").css({left: dx, top: dy}).show();

    console.log(this.state.cell.getAttribute[bmx.FIELD_BN]);   //--> undefined

        console.log("linked entity is set, hiding form elements.");
    } else {
        console.log("linked entity NOT set, showing form elements.");

    // delete works fine
    var deleteLink = $("#mx-menu-delete");
    deleteLink.on("click", {vertexHandler: this}, function(e){
        var vertexHandler = e.data.vertexHandler;



asked 29 May '12, 16:33

peteorpeter's gravatar image

accept rate: 0%

mxCell.getValue() returns cell.value (and has no args, see API specification). Use mxCell.getAttribute if the value is an XML node or normal JavaScript notation, ie. cell.value.propertyName.


answered 30 May '12, 02:40

Gaudenz's gravatar image

accept rate: 39%

cell.getAttribute(attr) worked, thanks! Should JS notation work all the time? Or does that fail if the userObject originates as XML?

(31 May '12, 10:30) peteorpeter

JS notation works for JS objects only.

(31 May '12, 11:03) Gaudenz
Your answer
toggle preview

Follow this question

By Email:

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



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



Asked: 29 May '12, 16:33

Seen: 6,275 times

Last updated: 31 May '12, 11:03