First Time If checking the parent node neither parent node getting checked nor child node getting checked

136 views Asked by At

I use Telerik kendo-tree-view to show popup inside which all parent node is there as checkbox.So when I should check parent node it should expand and check all child node automatically.But Not happening so and the issue is only for first time from second time working fine.

For first time when i check parent node it gets expand and have all child node but not checked. Refer the code below Html part:

<div class="col-md-10  col-sm-10 remove-padding" id="parent">
                    <div style="height: 300px;overflow-y: auto;border:1px solid black" id="adminTreeView" kendo-tree-view="tree"
                         k-data-source="rc.adminTreeData"
                         k-options="rc.adminTreeOptions" tabindex="3">
                    </div>

            </div>

Angular part:

rc.adminTreeOptions = {
            dataTextField: 'DisplayName',
            checkboxes: {
                checkParent:true,
                checkChildren: true
            },
            check: onCheck,
        };

    rc.GetResourcePermission = function (roleId) {
                rc.adminTreeData = new kendo.data.HierarchicalDataSource({
                    transport: {
                        read: function (e) {
                            var id = e.data.Id || 0;
                            roleService.getHierarchyResourceByParentId(id, roleId, (rc.SelectedClient == '' ? null : rc.SelectedClient), CurrentAppId).then(function (response) {
                                e.success(response);
                            });
                        }
                    },
                    schema: {
                        model: {
                            id: "Id",
                            hasChildren: "HasChild"
                        },
                        parse: function (response) {
                            return $.map(response, function (x) {
                                x.checked = x.Checked;
                                return x;
                            });
                        }
                    },
                    requestEnd: function () {
                        if (roleId != 0) {
                        if (angular.element("#adminTreeView").data("kendoTreeView") && angular.element("#adminTreeView").data("kendoTreeView").expand) {
                                angular.element("#adminTreeView").data("kendoTreeView").expand(".k-item");
                            }
                        }
                    },
                });
            }
0

There are 0 answers