Gantt Tree Data Binding to Flat Data
This article explains how to bind the Gantt Tree for Blazor to flat data. Before continuing, make sure you are familiar with the treelist data binding basics.
Flat data means that the entire collection of Gantt items is available at one level, for example List<MyGanttItemModel>.
The parent-child relationships are created through internal data in the model - the ParentId field which points to the Id of the item that will contain the current item. The root level has null for ParentId. There must be at least one node with a null value so that the Gantt Tree renders anything.
If there are child items for a certain node (items whose ParentId points to the current item's Id), it will have an expand icon. The HasChildren field can override this, however, but it is not required for flat data binding.
Example of flat data in a Gantt Tree - you need to point the TreeList to the Id and ParentId fields in your model