Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
804
getSelectedNode in javascript didn't fire
posted

I use the ultrawebTree methods (CSOM) getSelectedNode, but nothings happen. This is my function:

 

function changeImageSelectionne(treeView)

{

 

          var node = treeView.getSelectedNode();

 

}

 

 

In my ultrawebTree tag:

<ClientSideEvents NodeClick="changeImageSelectionne" />

 

Parents
No Data
Reply
  • 28407
    posted

    HI ,

    I am not sure where you created your treeview object.

     also  make sure the webtree's selectable property is set to "True"

     I could not reproduce. I created a sample page - I tested it and it works.

     aspx page:

    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

    <%@ Register assembly="Infragistics2.WebUI.UltraWebNavigator.v8.1, Version=8.1.20081.2161, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.UltraWebNavigator" tagprefix="ignav" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>

        <script type="text/javascript" id="igClientScript">
    <!--

    <!--

    <!--
    var tree =  null;
    function UltraWebTree1_NodeClick(treeId, nodeId, button){
     //Add code to handle your event here.
       tree = igtree_getTreeById(treeId);
      var node =  igtree_getNodeById(nodeId);
      var level = node.getLevel();
       if (level == 1)
       {
        tree.CancelPostBack = true;
       }
       else tree.CancelPostBack = false;
    }
    // -->

    function UltraWebTree1_BeforeNodeSelectionChange(treeId, oldNodeId, newNodeId){
     //Add code to handle your event here.
    }
    function Button1_onclick() {
      var node = tree.getSelectedNode();
      alert(node.Id);
    }

    // -->

    function UltraWebTree1_InitializeTree(treeId){
     //Add code to handle your event here.
      tree = igtree_getTreeById(treeId);
    }
    // -->
    </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
       
            <ignav:UltraWebTree ID="UltraWebTree1" runat="server" DefaultImage=""
                HiliteClass="" HoverClass="" Indentation="20"
                onnodeclicked="UltraWebTree1_NodeClicked" oninit="Page_Load">
                <ClientSideEvents NodeClick="UltraWebTree1_NodeClick"
                    BeforeNodeSelectionChange="UltraWebTree1_BeforeNodeSelectionChange"
                    InitializeTree="UltraWebTree1_InitializeTree" />
                <Levels>
                    <ignav:Level Index="0" />
                </Levels>
                <Nodes>
                    <ignav:Node Text="Root Node">
                        <Nodes>
                            <ignav:Node Text="Child Node">
                            </ignav:Node>
                            <ignav:Node Text="Child Node">
                            </ignav:Node>
                        </Nodes>
                    </ignav:Node>
                    <ignav:Node Text="Root Node">
                        <Nodes>
                            <ignav:Node Text="Child Node">
                            </ignav:Node>
                            <ignav:Node Text="Child Node">
                            </ignav:Node>
                        </Nodes>
                    </ignav:Node>
                </Nodes>
            </ignav:UltraWebTree>
       
        </div>
        </form>
        <p>
            <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" /></p>
    </body>
    </html>

Children
No Data