Javascript Issue -

Hello ,



Im new developing with godiragram , and i trying to use javascript when i click a node.

I made an user control defining the GoView control and

defined the following java script on the page :



function OpenWin(n)

{

alert(n);

return true;

}



Inside the code behind i wrote on the page load :



this.MyView.ObjectDoubleClicked += new GoObjectEventHandler(this.MyView_ObjectDoubleClicked);





I defined another function with the event



private void MyView_ObjectDoubleClicked(object sender, GoObjectEventArgs e)

{

GoObject obj = e.GoObject;

//Toma el objeto de nivel superior

//Si es un GoBasicNode

GoBasicNode n = obj.TopLevelObject as GoBasicNode;

if (n != null)

{

MyView.DataRenderer.LabeledNodeDoubleClick = “OpenWin(’” + n.Label.Text + “’)”;

}

}



The issue is when i click on the node im not getting the actual node instead im getting the before one.



I need this to open a new windows from javascript using the actual id node to call another method.



Thanks in Advance

You’re doing more than you need to… just initialize like this in Page_Load:



MyView.DataRenderer.LabeledNodeDoubleClick = “AlertLabel()”;



and add this javascript:



function AlertLabel() {

alert(goInfo.Text);

}

Thanks for the quick response , it helps , but i need to show on the node a Label and open another window with

the id of that node or other information.



Thanks in Advance.



Kinds Regards

Look through the samples that enable editing of node info… DataSetDemo is a good one to look at.

Hello ,



I have seen that example and there are using and hast table to build the diagram , in our case we are using and XML and the following code create it



public void RegisterTransformers(GoXmlReaderWriterBase rw)

{

GoDocument doc = new GoDocument();



GoXmlBindingTransformer bt = new GoXmlBindingTransformer(“graph”, doc);

rw.AddTransformer(bt);



GoBasicNode bn = new GoBasicNode(GoFigure.Terminator);



GoXmlBindingTransformer bt1 = new GoXmlBindingTransformer(“node”, bn);

bt1.HandlesNamedPorts = true;



bt1.AddBinding(“label”, “Text”);

bt1.AddBinding(“Port”, “Port”);

bt1.AddBinding(“tt”, “ToolTipText”);

bt1.AddBinding(“color”, “Shape.BrushColor”);

bt1.AddBinding(“gradient”, “Shape.BrushForeColor”);

rw.AddTransformer(bt1);



GoLabeledLink ll = new GoLabeledLink();

bn.Movable = false;

ll.ToArrow = true;

ll.BrushColor = Color.White;

ll.AvoidsNodes = true;



GoXmlBindingTransformer bt2 = new GoXmlBindingTransformer(“link”, ll);

bt2.AddBinding(“from”, “FromPort”);

bt2.AddBinding(“to”, “ToPort”);

bt2.AddBinding(“visible”, “Visible”);

rw.AddTransformer(bt2);

}



On the page load we have the following code :



object obj = DataBinder.GetPropertyValue(this.NamingContainer, “DataItem”);



if (obj != null)

{

string outputid = “”;

outputid = DataBinder.Eval(obj, “OutputId”).ToString();

//Se arma el Xml para bindear con el godiagram

string sXML;

sXML = ArmarXmlInterface(outputid);//this function build an formated XML.



GoXmlReader xr = new GoXmlReader();

RegisterTransformers(xr);



XmlDocument XML = new XmlDocument();

XML.LoadXml(sXML);

MyView.Document = (GoDocument)xr.Consume(XML);

}



LayerAction();



Thank in Advance



Kind Regards

Look at how DataSetDemo overrides GetPartInfo in PersonNode and how the aspx & script use that info.