Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

Callback when tree is ready

$
0
0

Hi,

 

The databound method gets called before data is processed. 

Code:

 

 TreeViewBuilder treeViewCntrl = HtmlHelperExtension.Kendo(page.Html).TreeView();
            treeViewCntrl 
                .DataTextField("Name")
                .Checkboxes(c => c.Enabled(true).CheckChildren(true).Template("<input type='checkbox' name='checkedNode' value='#= item.Id #' />"))                
                .DataSource(dataSource => dataSource
                    .Read(read => read
                        .Action("Action", "Controller").Data("additionalData")))
                        .Events(e => e.Expand("expand"))

                        .ExpandAll(true)

                        .Events(e => e.DataBound("DisableCheckboxes('" + mdl.SelectedFunctionIdForGrpReport + "')"));

 

<script type="text/javascript">              
              var additional = {};
  
            function expand(e) {
                var id = this.dataItem(e.node).Id;
                var name = this.dataItem(e.node).Name;
                additional.Id = id;
                //additional.Name = age;
            }
  
            function additionalData() {
                return additional;        
            }  

            function DisableCheckboxes(selectedIds) {      
                    if(selectedIds != '')
                    {
                        var treeview = $('#treeViewCntrl ').kendoTreeView().data('kendoTreeView');                   
                        var ids=selectedIds.split(',');
                        alert(selectedIds);
                        /*$.each(ids, function(i, id) {{
               var data = treeView.dataSource.getByUid(id);
                                if (data == id) {
                                    data.set('checked', true);
                                }
              }});*/
                    }
                }
            </script>

 

 

I want to select the checkboxes by default based for the selectedIds. And disable the control.

Please help.

 

Thanks,

Rajashree.


Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>