[英]Kendo UI treeview remove the expand arrow in kendo ui treeview if there are no child's to display - not working properly
I was attempting to use this code 我正在尝试使用此代码
How can i remove the expand arrow in kendo ui treeview if there are no child's to display 如果没有要显示的子项,我该如何删除kendo ui树视图中的展开箭头
Now, it is not the selected answer, but it is partially working for me 现在,它不是选定的答案,但对我有部分作用
Here is the answer I based my hasChildren on 这是我基于hasChildren的答案
var inline = new kendo.data.HierarchicalDataSource({
data: @Html.Raw(dataSource),
schema: {
model: {
children: "Children",
hasChildren: function(e) {
var test = e.Children.length;
return test > 0;
}
}
}
});
My code looks like this: 我的代码如下所示:
children: "items",
//hasChildren: "Id" // Id I was using as that is a key
hasChildren: function(e) {
var test = e.items.length;
return test > 0;
}
Problem, as soon as I click to expand any Parent Node I get an error 问题,当我单击以展开任何父节点时,我得到一个错误
Uncaught TypeError: Cannot read property 'length' of undefined
Why is this happening? 为什么会这样呢?
It sounds like the items property is sometimes null. 听起来项目属性有时为null。 Give a try to check if it exists first. 尝试检查它是否首先存在。
return e.items && e.items.length;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.