Skip to main content

TreeListExtension Class

An extension object implementing the TreeList functionality.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.2.dll

NuGet Package: DevExpress.Web.Mvc5

#Declaration

public class TreeListExtension :
    ExtensionBase

#Remarks

To declare the TreeList in a View, invoke the ExtensionsFactory.TreeList helper method. This method returns the TreeList extension that is implemented by the TreeListExtension class.

To configure the TreeList extension, pass the TreeListSettings object to the ExtensionsFactory.TreeList helper method as a parameter. The TreeListSettings object contains all the TreeList extension settings.

#Concepts

TreeList Overview

#Example

@Html.DevExpress().TreeList(settings => {
    settings.Name = "treeList";
    settings.CallbackRouteValues = new { Controller = "Editing", Action = "BatchEditingPartial" };
    settings.SettingsEditing.BatchUpdateRouteValues = new { Controller = "Editing", Action = "BatchEditingUpdateModel" };

    settings.SettingsEditing.Mode = TreeListEditMode.Batch;

    settings.Columns.Add("From");
    settings.Columns.Add("Subject");
    settings.Columns.Add(c => {
        c.FieldName = "PostDate";
        c.Caption = "Date";
        c.EditorProperties().DateEdit(p => {
            p.DisplayFormatString = "dd/MM/yyyy hh:mm tt";
            p.DisplayFormatInEditMode = true;
            p.EditFormat = EditFormat.DateTime;
        });
    });
    settings.Columns.Add(c => {
        c.FieldName = "IsNew";
        c.ColumnType = MVCxTreeListColumnType.CheckBox;
        c.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
    });
    ...
}).SetEditErrorText(ViewData["EditNodeError"] as string).Bind(Model).GetHtml()

#Online Demos

Tree List Demos

#Inheritance

See Also