除非扩展节点,否则kendo treeview数据源不会在javascript调试中显示子项 [英] kendo treeview datasource not showing children items in javascript debug unless node is expanded

查看:61
本文介绍了除非扩展节点,否则kendo treeview数据源不会在javascript调试中显示子项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Kendo TreeView ,其中父节点和子节点都同时获得.

I have a Kendo TreeView in which the parent nodes and children are all gotten at the same time.

以前,我要进行单独的调用,除非扩展了父节点,否则它不会调用查询并将该数据作为子项拉入父节点

Previously I was having the separate calls of which unless a Parent node was expanded, it did not call a query and pull that data into the parent node as children

现在我可以一次提取所有数据,我希望能够执行各种CRUD操作,在该操作中,如果创建,删除节点,更改排序顺序,然后在Button上单击我要全部发送"数据.

Now that I have my data pulled all at once, I want to be able to do all sorts of CRUD operation in which if a node is created, deleted, sort order changed, then on Button click I want to send in all the data.

问题:

我注意到在执行console.log(mydatasource.data());时, 我正在看到EMPTY子项.

I noticed that in doing a console.log(mydatasource.data()); that I am seeing EMPTY children items.

似乎如果我展开(或展开并折叠)之后,我会获得子项显示在chrome dev中工具输出

这肯定是一个大问题,因为我试图发送完整的数据,然后对本质上3个数据库表中的所有数据运行CRUD操作....

This is certainly a huge problem as I'm trying to send in the complete data and then run CRUD operations on all the data from essentially 3 database tables....

这是为什么以及如何发生?

// show my data in chrome browser that is getting sent to mvc method
console.log(homogeneous.data());  

Kendo TreeView

Kendo TreeView

var homogeneous = new kendo.data.HierarchicalDataSource({
        transport: {
            read: {
                url: serviceRoot + "/GetReportGroupAssignments", 
                dataType: "json" 
            }
        },

        schema: {
            model: {
                id: "Id" 
                ,
                children: "items",
                hasChildren: "Id"
            }
        }
    });

var treeview = $("#treeview").kendoTreeView({
            expanded: true,
            dragAndDrop: true,
            select: onSelect,
            dataSource: homogeneous,
            dataTextField: "ReportGroupName" 
            ,
            template: kendo.template($("#treeview-template").html()) //,
        }).data("kendoTreeView");

推荐答案

尝试设置

Try to set loadOnDemand to false.

这篇关于除非扩展节点,否则kendo treeview数据源不会在javascript调试中显示子项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆