TreeGrid does not render if source data has an expression bodied member

Hello, 

Is the source data type for a tree grid unable to have an expression bodied member even if that member is not used as a field in a defined tree grid column? See the attached example. 

Line 25 has: 

 public int X => 100;

This stops the treeGrid from rendering anything. If this line is commented out the program works correctly. 


Thank you


Attachment: TreeGridSample_dfd6bd88.zip

1 Reply 1 reply marked as answer

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team September 19, 2022 02:26 PM UTC

Hi Leland,


We are able to replicate the problem from your provided details. This issue occurs when we use the properties without get set method. In Tree Grid, get and set method are required since we have processed the data and handled the properties internally to maintain the Tree Grid's hierarchical structure. To avoid the problem we suggest you use properties of the datasource class with get set method.


Refer to the modified code below:-

public class BusinessObject

    {

        public int TaskId { get; set; }

        public string TaskName { get; set; }

        public int Duration { get; set; }

        public int Progress { get; set; }

        public string Priority { get; set; }

        public int? ParentId { get; set; }

 

        public int X { get; set; } = 100;

    }


Kindly get back to us if you need any further assistance.


Regards,

Farveen sulthana T


Note:- If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.



Marked as answer
Loader.
Up arrow icon