Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Object doesn't support property or method 'getNodeAt' (Read 1747 times)
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Object doesn't support property or method 'getNodeAt'
Dec 24th, 2013 at 3:17pm
Print Post  
Hi,

First off, Merry Christmas and all the best to you and your family.

Based on some earlier advice from these forums, I am attempting to implement a contextual menu when a user right-clicks on a node in the diagram.  I have got that working.

What I also need to do is gain access to the node's tag value.  This is where I'm having a problem.

Here's my mousedown code:

Code (Javascript)
Select All
function onNodeMouseDown(e) {
                if (e.button == 2 /* for right click */) {
                    // show the context menu and place it at the mouse cursor
                    var contextMenu = $find("<%= ctmTask.ClientID %>");
                    if (contextMenu) {
                        var diagram = document.getElementById("<%= DiagramView1.ClientID %>");
                        var node = diagram.getNodeAt(e.clientX, e.clientY);
                        var tag = node.getTag();
                        alert('tag = ' + tag);
                        $telerik.cancelRawEvent(e);
                        contextMenu.showAt(e.clientX, e.clientY);
                    }
                }
            } 



The diagram is an object, not null.

What silly thing am I doing wrong?

Thanks

Jim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Object doesn't support property or method 'getNodeAt'
Reply #1 - Dec 26th, 2013 at 11:55am
Print Post  
Hi,

Is this in JavaApplet mode? In such case, getElementById would return a DiagramApplet instance, and you will have to call its getDiagram() method to get the Diagram object. In addition, getNodeAt method takes a Point2D argument, which you can create by calling ScriptHelper.createPointF(x, y).

If this is ImageMap mode and you are adding the handler via CreatingAreaElement, you could transfer the tag value by assigning it to some attribute of the AREA element. In ImageMap mode, getElementById(clientId) returns a simple DIV element that contains the diagram's IMG elements. I.e. you cannot call Diagram methods from the client side, unless you do that via Ajax calls to the server.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint