TreeGrid
Namespace: Wisej.Web.Ext.Syncfusion2
Assembly: Wisej.Web.Ext.Syncfusion2 (4.1.0.0)
The TreeGrid component is a feature-rich control used to visualize self-referential hierarchical data effectively in a tabular format.
- C#
- VB.NET
public class TreeGrid : ej2Base
Public Class TreeGrid
Inherits ej2Base
Constructors
TreeGrid()
Constructs a new instance of the TreeGrid class.
Example:
The following example creates a tree grid bound to hierarchical data, where the child rows are in the subtasks field, through the Options object.
var treeGrid = new TreeGrid();
treeGrid.Options.childMapping = "subtasks";
treeGrid.Options.treeColumnIndex = 0;
treeGrid.Options.dataSource = new[]
{
new
{
task = "Planning",
duration = 5,
subtasks = new[] { new { task = "Requirements", duration = 3 }, new { task = "Budget", duration = 2 } }
}
};
treeGrid.Dock = DockStyle.Fill;
this.Controls.Add(treeGrid);
TreeGrid(options)
Constructs a new instance of the TreeGrid class.
| Name | Type | Description |
|---|---|---|
| options | Object | Initial set of options. |
Example:
The following example creates a tree grid bound to self-referential data, where each row refers to its parent through the parentId field.
var treeGrid = new TreeGrid(new
{
idMapping = "id",
parentIdMapping = "parentId",
treeColumnIndex = 1,
columns = new object[]
{
new { field = "id", headerText = "ID", width = 80, isPrimaryKey = true },
new { field = "name", headerText = "Employee", width = 200 },
new { field = "title", headerText = "Title", width = 180 }
},
dataSource = new object[]
{
new { id = 1, parentId = (int?)null, name = "Nancy Davolio", title = "CEO" },
new { id = 2, parentId = (int?)1, name = "Andrew Fuller", title = "Sales Manager" },
new { id = 3, parentId = (int?)2, name = "Janet Leverling", title = "Sales Representative" }
}
});
treeGrid.Dock = DockStyle.Fill;
this.Controls.Add(treeGrid);