Skip to main content

ejTreeView

Namespace: Wisej.Web.Ext.Syncfusion

Assembly: Wisej.Web.Ext.Syncfusion (4.1.0.0)

TreeView control for JavaScript represents hierarchical data in tree like structure with advanced functions to perform edit, drag and drop, selection with checkboxes and more. TreeView can be generated from ‘UL LI’ elements, JSON data source or using OData services.

public class ejTreeView : ejBase

Constructors​

Instance member ejTreeView()​

Constructs a new instance of the ejTreeView class.

Example:

The following example creates the tree view and binds it to a self-referential list of nodes through the options.

var treeView = new ejTreeView();
treeView.Options.fields = new
{
dataSource = new object[]
{
new { id = 1, name = "Documents", hasChild = true, expanded = true },
new { id = 2, pid = 1, name = "Invoices" },
new { id = 3, pid = 1, name = "Contracts" }
},
id = "id",
parentId = "pid",
text = "name",
hasChild = "hasChild",
expanded = "expanded"
};
treeView.Dock = DockStyle.Left;
this.Controls.Add(treeView);

Instance member ejTreeView(options)​

Constructs a new instance of the ejTreeView class.

NameTypeDescription
optionsObjectInitial set of options.

Example:

The following example creates a tree view with check boxes, shows the node selected by the user and expands all the nodes.

var treeView = new ejTreeView(new
{
showCheckbox = true,
fields = new { dataSource = folders, id = "Id", parentId = "ParentId", text = "Name", hasChild = "HasChild" }
});
treeView.Instance.onNodeSelect += new WidgetEventHandler((s, e) =>
{
AlertBox.Show($"Selected node: {e.Data.id}");
});
treeView.Dock = DockStyle.Left;
this.Controls.Add(treeView);

// later, i.e. in the handler of a button.
treeView.Instance.expandAll();

Implements​