gpt4 book ai didi

angularjs - Kendo treeList 数据源 - 未绑定(bind)远程数据

转载 作者:行者123 更新时间:2023-12-03 22:51:02 25 4
gpt4 key购买 nike

我已经为 treeList 编写了一个指令,并将数据从远程服务调用绑定(bind)到它。下面是指令链接方法中 TreeListDataSource 的代码:

scope.treeListOptions.dataSource = new kendo.data.TreeListDataSource({
transport: {
read: function(options) {
scope.getData().then(function(dataToBeDisplayed) {
options.success(dataToBeDisplayed);
}, function(error) {
$log.error(error);
});
},
error: function(e) {
alert(e.status + e.errorThrown);
},
},
});

scope.treeListOptions.dataSource.read();


以下是 TreeList 指令定义:

var TreeListDirectiveDefinition = {
restrict: 'E',
replace: true,
template: '<div><kendo-treelist k-options="treeListOptions"></kendo-treelist></div>',
scope: {
columns: '=',
getMethod: '&'
},
link: linkTreeList
};


当我看到绑定(bind)到 scope.treeListOptions.dataSource.data() 的数据时,添加了许多新属性,如下所示:

// parent element
C.define.init
PartExamined: "test"
StudyUid: "1.3.6.1.4.1.30071.8.56809868014.4964677242993979.234.56616"
_events: Object
_loaded: true
dirty: false
hasChildren: true
id: 1
parent: ()
parentId: null
parentIdField: "parentId"
uid: "1ca6302c-b1ad-493f-b002-d2032a548a80"
__proto__: i.extend.i


//child element
C.define.init
PartExamined: "test2"
SeriesInstanceUid: "1.3.6.1.4.1.30071.8.56809868014.4964677242993979.234.56617"
_events: Object
_loaded: true
dirty: false
hasChildren: false
id: 2
parent: ()
parentId: 1
parentIdField: "parentId"
uid: "953bc7a7-e5e8-4f26-a120-b13402c6cce4"
__proto__: i.extend.i


属性如 parent: (), parentIdField: "parentId", _loaded: true,dirty: false, hasChildren: true 由 TreeListDataSource 添加。

这是正确的数据格式吗?因为 TreeList 正在显示 “没有要显示的记录” .

谁能帮我解决这个问题?

更新
这是为 treeList 创建的 angular 指令的链接: http://jsfiddle.net/yuqorcvL/15/

该指令仍然无效。任何帮助将不胜感激。

谢谢。

最佳答案

您应该添加 schemascope.treeListOptions.dataSource

schema: {
model: {
id: "EmployeeID",
parentId: "ReportsTo",
fields: {
ReportsTo: { field: "ReportsTo", nullable: true },
EmployeeID: { field: "EmployeeId", type: "number" },
Extension: { field: "Extension", type: "number" }
},
expanded: true
}
}

that example在 Kendo 文档中

关于angularjs - Kendo treeList 数据源 - 未绑定(bind)远程数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32777830/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com