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

Getting the Root node

1 Answer 117 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Tejas Kan
Top achievements
Rank 1
Tejas Kan asked on 29 Aug 2011, 03:59 AM
Hi
I have the following telerik:RadTreeList 

<telerik:RadTreeList ID="RadTreeListFacility" runat="server" DataKeyNames="Key" ParentDataKeyNames="SuperiorFacilityID"
        AutoGenerateColumns="False" Width="100%" AllowMultiItemEdit="False" Culture="(Default)"
        OnNeedDataSource="RadTreeListFacility_NeedDataSource">
        <Columns>
            <telerik:TreeListSelectColumn UniqueName="SelectColumn" Visible="false" />
            <telerik:TreeListBoundColumn DataField="Name" UniqueName="Name" HeaderText="Display Name" />
            <telerik:TreeListBoundColumn DataField="Key" UniqueName="Key" HeaderText="Unique ID" />
            <telerik:TreeListBoundColumn DataField="FacilityType" UniqueName="FacilityType" HeaderText="Type" />
            <telerik:TreeListBoundColumn DataField="SuperiorFacilityID" UniqueName="SuperiorFacilityID"
                HeaderText="Parent ID" Visible="false" />
            <telerik:TreeListTemplateColumn ItemStyle-Width="100px" HeaderStyle-Width="100px">
                <HeaderTemplate>
                </HeaderTemplate>
                <ItemTemplate>
                    <span onclick="Edit_OnClick({Key:'<%# Eval("Key") %>',Name:'<%# Eval("Name")%>',SID:'<%# Eval("SuperiorFacilityID")%>',Type:'<%# Eval("FacilityType")%>'});">
                        <img src="../../images/DataEditing/Edit.gif" title="Update Selected Clinic" alt="Update Selected Clinic" />
                    </span>
                    <span onclick="AddSubFacility_OnClick({SID:'<%# Eval("Key")%>'});">
                        <img src="../../images/DataEditing/AddRecord.gif" title="Add Below Selected Clinic"
                            alt="Add Below Selected Clinic" />
                    </span>
                    <span onclick="Delete_OnClick({Key:'<%# Eval("Key") %>',Name:'<%# Eval("Name")%>'});">
                        <img src="../../images/DataEditing/Delete.gif" title="Delete Selected Clinic" alt="Delete Selected Clinic" />
                    </span>
                </ItemTemplate>
            </telerik:TreeListTemplateColumn>
        </Columns>
        <ClientSettings AllowPostBackOnItemClick="false">
            <Selecting AllowItemSelection="true" AllowToggleSelection="true" />
        </ClientSettings>
    </telerik:RadTreeList>


This tree has only one root node element.
Using Javascript I want to get hold of the Root element.
I have tried
var tree = $find("<%= RadTreeListFacility.ClientID %>");
var node0 = tree.get_nodes().getNode(0);


This dose not work


Also I would like to know how to get values the Key and the Name DataField values of the root node client side. Thanks in advance. Tejas

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 31 Aug 2011, 12:17 PM
Hi Tejas,

I would advise you to take a look at the treelist client API articles in order to see which properties and methods you need. More specifically for your scenario:
get_dataItems
get_dataKeyValue
Getting Familiar with RadTreeList Client-Side API

Kind regards,
Tsvetina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
TreeList
Asked by
Tejas Kan
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or