We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Id and Parent are Guids. EJ.TreeView crashes

I tried this kind of system:
    public class LoadData
    {
        public Guid Id { get; set; }
        public Guid Parent { get; set; }
        public string Text { get; set; }
        public string SpriteImage { get; set; }
        public string ImageURL { get; set; }
        public bool HasChild { get; set; }
        public bool Expanded { get; set; }
        public bool Selected { get; set; }
        public bool NodeChecked { get; set; }
        public object NodeProperty { get; set; }
        public object LinkProperty { get; set; }
        public object ImageProperty { get; set; }
    };

            VM_TenantUserEdit vm = new VM_TenantUserEdit { TenantId = tenantId };
            vm.datasource = new List<LoadData>();
            Guid g1 = Guid.NewGuid();
            Guid g2 = Guid.NewGuid();
            Guid g3 = Guid.NewGuid();
            Guid g4 = Guid.NewGuid();
            Guid g5 = Guid.NewGuid();
            Guid g6 = Guid.NewGuid();
            Guid parent = Guid.Empty;

            vm.datasource.Add(new LoadData { Id = g1, Parent = parent, Text = "Item 1" });
            vm.datasource.Add(new LoadData { Id = g2, Parent = parent, Text = "Item 2" });
            vm.datasource.Add(new LoadData { Id = g3, Parent = parent, Text = "Item 3" });
            vm.datasource.Add(new LoadData { Id = g4, Parent = g1, Text = "Item 1.1" });
            vm.datasource.Add(new LoadData { Id = g5, Parent = g1, Text = "Item 1.2" });
            vm.datasource.Add(new LoadData { Id = g6, Parent = g3, Text = "Item 3.1" });

 <form>
        <div style="width: 250px">

            @(Html.EJ().TreeView("tree")
            .TreeViewFields(field =>
                field.Datasource(Model.datasource)
                .Id("Id")
                .ParentId("Parent")
                .Text("Text")
                ).ShowCheckbox(true))
        </div>
<form>
It seems that if the keys are Guids, EJ.TreeView crashes. So building the hierarchy with other keys than integer does not work.

In addition, when used inside of a form, tree control should return the id instead of Text. In a localized sw the text can be a random string, but id is always the same.


1 Reply

AB Ashokkumar Balasubramanian Syncfusion Team October 6, 2017 12:09 PM UTC

Hi Olavi, 
 
Thanks for contacting Syncfusion support. 
 
Query 1: It seems that if the keys are Guids, EJ.TreeView crashes. So building the hierarchy with other keys than integer does not work. 
 
We have checked your problem (Unable to building the keys other than integer) in TreeView component, but unfortunately, we are able to reproduce this problem at our end. Please check the below sample. 
 
 
For that sample, we have building the hierarchy with string and used to TreeView component. 
 
Query 2: In addition, when used inside of a form, tree control should return the id instead of Text. In a localized sw the text can be a random string, but id is always the same. 
 
We were unable to understood your exact requirement. Could you please explain your requirement briefly or else please modify the provided sample as like your requirement. This is would be more helpful to provide the proper solution earliest.  
 
Regards, 
Ashokkumar B. 


Loader.
Live Chat Icon For mobile
Up arrow icon