How can i remove the expand arrow in kendo ui tree

2019-06-07 14:21发布

I am using kendo ui treeview. I am loading the treeview dynamically from the database. But my issue is i am getting the expand error if there are no child's to display. How can i remove the expand arrow.

Regards,

Sri

2条回答
我只想做你的唯一
2楼-- · 2019-06-07 15:13

for an example, I have declared my function like this in my Kendo Ui TreeView :

 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; 
                }
            }
        }
    });

And for my, it works perfectly !

查看更多
孤傲高冷的网名
3楼-- · 2019-06-07 15:22

There is a configuration field of the HierarchicalDataSource schema.model object called hasChildren you can add a boolean property to your model which indicates if the your model has items.

This way when the TreeView creates its elements it will check that property (or call the function - you could for example return if the items.leght is greater than zero) and if the returned value is false it wont create the expand arrow in front of the item.

Check this demo.

查看更多
登录 后发表回答