Please help me checkbox in treelist

1 posts, 0 answers
  1. Du
    Du avatar
    4 posts
    Member since:
    Jun 2012

    Posted 14 Jun 2012 Link to this post

    Hi all!
     
    I want used checkbox in telerik:TreeListSelectColumn , I need to implement the recursive selection at this way:
    1. Select all parents when the at least one child item was selected.
    2. Select all childs when the parent was selected 
    But when I'm runing my project, debuging function itemSelected (), error selectedItem.get_parentItem()  and display error : 
    Object doesn't support property or method 'get_parentItem'

    I'm add  Telerik.Web.UI 3.5 use for Dotnetnuke 4.5.9 .net Framework 2.0, unknow Can I use ?

    Thank for help!

    function itemSelected(sender, args) {
        var treelist = sender;
        var selectedItem = args.get_item();
        if(selectedItem.get_parentItem())
        treelist.selectItem(selectedItem.get_parentItem());
         //comment out the above line and uncomment the below one to get all child items selected functionality
        //selectChildren(selectedItem);
      
      
        function selectChildren(item) {
            treelist.selectItem(item);
            if (item.get_childItems().length > 0) {
                  
                for (var i = 0; i < item.get_childItems().length; i++) {
                    selectChildren(item.get_childItems()[i]);
                }
            }
        }
    }
     
     
     
    <telerik:RadTreeList runat="server" ID="RadTreeList1" DataKeyNames="Id" ParentDataKeyNames="CongViecChaId" OnItemCommand="RadTreeList1_ItemCommand"
           AllowMultiItemSelection="True" AllowPaging="false"  AllowSorting="true" Skin="Hay"
           AutoGenerateColumns="false" OnNeedDataSource ="RadTreeList1_NeedDataSource" OnItemCreated="RadTreeList1_ItemCreated" OnItemDataBound="RadTreeList1_ItemDataBound" >
                <Columns>
                    <telerik:TreeListSelectColumn HeaderStyle-Width="40px" UniqueName="chkColum" >
                    </telerik:TreeListSelectColumn>
                    <telerik:TreeListBoundColumn DataField="Id" HeaderText="Id" UniqueName="Id" Visible="false">
                    </telerik:TreeListBoundColumn>
    <telerik:TreeListBoundColumn DataField="MaCongViec" HeaderText="Mã Công Việc" UniqueName="MaCongViec">
                    </telerik:TreeListBoundColumn>
                    <telerik:TreeListBoundColumn DataField="TenCongViec" HeaderText="Tên Công Việc" UniqueName="TenCongViec">
                    </telerik:TreeListBoundColumn>
                    <telerik:TreeListBoundColumn DataField="CongViecChaId" HeaderText="Công việc cha id" UniqueName="CongViecChaId" Visible="false">
                    </telerik:TreeListBoundColumn>
                   <telerik:TreeListBoundColumn DataField="MoTa" HeaderText="Mô tả" UniqueName="MoTa">
                    </telerik:TreeListBoundColumn>
                    <telerik:TreeListBoundColumn DataField="TinhTrang" HeaderText="Tình trạng" UniqueName="TinhTrang">
                    </telerik:TreeListBoundColumn>
                </Columns
         <ClientSettings Selecting-AllowItemSelection="true">
            <ClientEvents OnItemSelected="itemSelected" />
        </ClientSettings>
      </telerik:RadTreeList>
Back to Top