This is a migrated thread and some comments may be shown as answers.

Problem with get Nodes JS

1 Answer 49 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Silvia
Top achievements
Rank 1
Silvia asked on 18 Oct 2011, 05:47 PM
Hi,

I need to get an array of the root nodes of my tree view, but when i try, the tree view is a divElement and the nodes indefined.
This is my code:
JS:
function deshabilitarNodos(treeView, args) {
    alert("Llegue");
    var tree = <%=RadTreeView2.ClientID %>
    alert (tree);
    var nodosPrincipales= tree.Nodes;
    alert(nodosPrincipales);  // This is indefined
}

ASP:
<telerik:RadTreeView ID="RadTreeView2" runat="server" Width="300px" 
            Height="900px" DataFieldID="Id" DataFieldParentID="Padre" 
            ImageUrlField ="Imagen" DataSourceID="ObjectDataSource1" 
            DataTextField="Nombre" DataValueField="Id" OnClientNodeExpanding="deshabilitarNodos" >


            <DataBindings>
                <telerik:RadTreeNodeBinding ImageUrlField="Imagen" Expanded="false" />
            </DataBindings>
        </telerik:RadTreeView>


        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            SelectMethod="cargarSegmentos" TypeName="PL.Util.cliente">
        </asp:ObjectDataSource>

Thanks.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Oct 2011, 11:34 AM
Hello Silvia,

You can use get_allNodes() to get the nodes of TreeView.

JS:
<script type="text/javascript">
function OnClientNodeExpanding(sender, args)
{
  var nodes = sender.get_allNodes();
}
</script>

You can check the following documentation.
Client-Side Programming Basics

Thanks,
Princy.
Tags
ListView
Asked by
Silvia
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or