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

Select the header checkbox in javascript

2 Answers 59 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Su Sundee
Top achievements
Rank 1
Su Sundee asked on 23 Apr 2012, 12:34 PM
Hello,

First of all, I'm not good at English. I'm sorry for that.
I have a TreeList and I used the OnItemSelected and OnItemDeselected client event.
In this event, how can i know user is selected the header checkbox column or row checkbox column?
I try the whole day but I still can't find it.
Anyone, please help me!.

Thanks & Regards,
Sundee

2 Answers, 1 is accepted

Sort by
0
Su Sundee
Top achievements
Rank 1
answered on 30 Aug 2013, 10:26 AM
Hello,

I have a TreeList and I used the OnItemSelected and OnItemDeselected client event.
In this event, how can i know user is selected the header checkbox column or row checkbox column?
I try the whole day but I still can't find it.
Anyone, please help me!.

Thanks & Regards,
Sundee
0
Shinu
Top achievements
Rank 1
answered on 12 Nov 2013, 11:48 AM
Hi Su Sundee,

Please have a look into the sample code I tried to achieve your scenario.

ASPX:
<telerik:RadTreeList ID="RadTreeList1" runat="server" DataKeyNames="EmployeeID" ParentDataKeyNames="ReportsTo"
    AutoGenerateColumns="false" DataSourceID="SqlDataSource1" PageSize="5" ClientDataKeyNames="EmployeeID"
    AllowMultiItemSelection="true">
    <Columns>
        <telerik:TreeListSelectColumn HeaderStyle-Width="38px" UniqueName="EmployeeID">
        </telerik:TreeListSelectColumn>
        <telerik:TreeListBoundColumn DataField="EmployeeID" HeaderText="EmployeeID" HeaderStyle-Width="80px"
            UniqueName="a">
        </telerik:TreeListBoundColumn>
        <telerik:TreeListBoundColumn DataField="LastName" HeaderText="LastName" UniqueName="b">
        </telerik:TreeListBoundColumn>
        <telerik:TreeListBoundColumn DataField="ReportsTo" HeaderText="ReportsTo" UniqueName="c">
        </telerik:TreeListBoundColumn>
    </Columns>
    <ClientSettings Selecting-AllowItemSelection="true">
        <ClientEvents OnItemSelected="OnItemSelected"></ClientEvents>
    </ClientSettings>
</telerik:RadTreeList>

JavaScript:
<script type="text/javascript">
    function OnItemSelected(sender, args) {
        var checkbox = $get("RadTreeList1").getElementsByTagName("input")[0];
        if (checkbox.checked == true)
          //header checkbox is selected
        else
            //row checkbox is selected
    }
</script>

Thanks,
Shinu.
Tags
TreeList
Asked by
Su Sundee
Top achievements
Rank 1
Answers by
Su Sundee
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Share this question
or