Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfTreeGrid<TValue>

    Show / Hide Table of Contents

    Class SfTreeGrid<TValue>

    SfTreeGrid is a feature-rich Blazor component used to visualize self-referential or hierarchical data effectively in a tabular format.

    Inheritance
    System.Object
    SfBaseComponent
    SfDataBoundComponent
    SfTreeGrid<TValue>
    Inherited Members
    SfDataBoundComponent.SetDataManager<T>(Object)
    SfDataBoundComponent.DataManager
    SfDataBoundComponent.MainParent
    SfBaseComponent.Dispose(Boolean)
    Namespace: Syncfusion.Blazor.TreeGrid
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SfTreeGrid<TValue> : SfDataBoundComponent, ITreeGrid, ISfCircularComponent
    Type Parameters
    Name Description
    TValue

    A type which provides schema for the treegrid component.

    Constructors

    SfTreeGrid()

    Declaration
    public SfTreeGrid()

    Properties

    Aggregates

    Gets or sets an instance of TreeGridAggregate collection, which controls the rendering of aggregate rows displayed in the tree grid content.

    Declaration
    public List<TreeGridAggregate> Aggregates { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<TreeGridAggregate>

    A List instance of TreeGridAggregate.

    Remarks

    TreeGridAggregate class provides various properties to customize aggregate operations.

    Examples
     
    <SfTreeGrid DataSource="@TreeGridData" AllowSorting="true" AllowFiltering="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update", "Search" })"> 
        <TreeGridAggregates> 
            <TreeGridAggregate ShowChildSummary="false"> 
                <TreeGridAggregateColumns> 
                <TreeGridAggregateColumn Field="Duration" Type="Syncfusion.Blazor.Grids.AggregateType.Sum" Format="C2"></TreeGridAggregateColumn> 
                </TreeGridAggregateColumns> 
            </TreeGridAggregate> 
        </TreeGridAggregates>
    </SfTreeGrid> 

    AllowExcelExport

    Gets or sets whether to allow exporting the tree grid data to excel and CSV.

    Declaration
    public bool AllowExcelExport { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to allow the user to export tree grid data to Excel file; otherwise, false.The default value is false.

    Remarks

    Exporting can be customized using ExcelExportProperties type parameter of ExportToExcelAsync(ExcelExportProperties, Nullable<Boolean>, Object, Nullable<Boolean>) method.

    AllowFiltering

    Gets or sets whether to allow filtering tree grid data in the columns.

    Declaration
    public bool AllowFiltering { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to allow filtering; otherwise, false.The default value is false.

    Remarks

    You can cancel or customize the filtering action through OnActionBegin event handler.

    AllowFreezeLineMoving

    Gets or sets whether to allow the user to move the frozen line by dragging and dropping it between columns. Frozen columns are updated corresponding to frozen line position.

    Declaration
    public bool AllowFreezeLineMoving { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if allowed to adjust freeze line; otherwise, false. By default, the property value is false.

    Remarks

    Enable FreezeLineMoving property that helps to increase/decrease the frozen columns by drag-and-drop the freeze bar between columns.

    Examples
    <SfTreeGrid AllowFreezeLineMoving=true FrozenColumns="2" Height="500" Width="500">
    ..
    </SfTreeGrid>

    AllowMultiSorting

    Gets or sets whether to allow user to sort multiple tree grid columns.

    Declaration
    public bool AllowMultiSorting { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if need to enable multiple columns sorting; otherwise, false.The default value is true.

    Remarks

    To sort multiple column hold CTRL key and click the column header. To clear sort for a column, hold SHIFT key and click the column header.

    AllowPaging

    Gets or sets whether to render pager at bottom of tree grid.

    Declaration
    public bool AllowPaging { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to enable paging actions in tree grid; otherwise, false.The default value is false.

    Remarks

    You can cancel or customize the paging action through the OnActionBegin event handler.

    AllowPdfExport

    Gets or sets whether to allow export tree grid data in pdf.

    Declaration
    public bool AllowPdfExport { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to allow exporting PDF document; otherwise, false.The default value is false.

    Remarks

    Exporting can be customized using PdfExportProperties type parameter of ExportToPdfAsync(PdfExportProperties, Nullable<Boolean>, Object, Nullable<Boolean>) method.

    AllowReordering

    Gets or sets whether to allow reordering of tree grid columns. Reordering can be done by drag and drop of a particular column from one index to another column index.

    Declaration
    public bool AllowReordering { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to allow column reorder; otherwise, false.The default value is false.

    Remarks

    You can cancel or customize the reordering action through OnActionBegin event handler.

    AllowResizing

    Gets or sets whether to allow resizing of tree grid columns.

    Declaration
    public bool AllowResizing { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to allow columns resizing; otherwise, false.The default value is false.

    Remarks

    You can also prevent the resize of the particular column through setting AllowResizing column property.

    AllowRowDragAndDrop

    Gets or sets whether to allow row reordering in tree grid.

    Declaration
    public bool AllowRowDragAndDrop { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to allow row drag and drop in tree grid; otherwise, false.The default value is false.

    Remarks

    You can cancel or customize the row reorder action through OnRowDragStart event handler.

    AllowSelection

    Gets or sets whether to allow selection of tree grid rows.

    Declaration
    public bool AllowSelection { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to allow sorting of records; otherwise, false.The default value is false.

    Remarks

    To perform the multi-selection, hold CTRL key and click the desired rows/cells. To select range of rows/cells, hold SHIFT key and click the rows/cells.The default value is false. You can cancel or customize the selection action through RowSelecting event handler.

    AllowSorting

    Gets or sets whether to allow sorting of tree grid columns.

    Declaration
    public bool AllowSorting { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to allow sorting of records; otherwise, false.The default value is false.

    Remarks

    You can cancel or customize the sorting action through OnActionBegin event handler.

    AllowTextWrap

    Gets or sets whether to allow wrapping for text content in tree grid cells.

    Declaration
    public bool AllowTextWrap { get; set; }
    Property Value
    Type Description
    System.Boolean

    true need to wrap the cell texts; otherwise, false.The default value is false.

    AutoCheckHierarchy

    Gets or sets whether the tree column checkboxes should be checked hierarchically.

    Declaration
    public bool AutoCheckHierarchy { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to change the checkbox state of parent or child row checkboxes on either of the row checkbox change; otherwise, false.The default value is false.

    Remarks

    ShowCheckbox should be enabled.

    ChildMapping

    Specifies the mapping property path for child records in data source.

    Declaration
    public string ChildMapping { get; set; }
    Property Value
    Type Description
    System.String

    Field name which maps the child records. The default value is null.

    Remarks

    It is applicable only for hierarchy type data binding in tree grid.

    ClipMode

    Defines how to display the text content in the tree grid cell when it overflows.

    Declaration
    public ClipMode ClipMode { get; set; }
    Property Value
    Type Description
    ClipMode

    One of the ClipMode enumeration that specifies how the cell content is displayed. The default mode is Syncfusion.Blazor.Grids.ClipMode.Clip.

    Remarks

    The available modes are, Clip: Truncates the cell content when it overflows its area. Ellipsis: Displays ellipsis when the cell content overflows its area. EllipsisWithTooltip: Displays ellipsis when the cell content overflows its area and also, and it displays the tooltip on mouse hover.

    ColumnChooserSettings

    Gets or sets an instance of TreeGridColumnChooserSettings which configures the column chooser for hiding and showing columns dynamically.

    Declaration
    public TreeGridColumnChooserSettings ColumnChooserSettings { get; set; }
    Property Value
    Type Description
    TreeGridColumnChooserSettings

    A List instance of TreeGridColumnChooserSettings

    Remarks

    TreeGridColumnChooserSettings class provides various properties to customize column chooser.

    Examples
    <SfTreeGrid DataSource="@TreeGridData" TreeColumnIndex="1" Toolbar="@(new List<string>() { "Search" })">
    	<TreeGridColumnChooserSettings ignoreAccent="true" operator="startsWith"></TreeGridColumnChooserSettings>
    </SfTreeGrid>

    ColumnMenuItems

    Gets or sets both built-in and custom column menu items. Built-in items are provided as instance List of object and custom column menu items are provided as List instance of 'Syncfusion.Blazor.Grids.ColumnMenuItemModel'.

    Declaration
    public object ColumnMenuItems { get; set; }
    Property Value
    Type Description
    System.Object

    The available built-in items are, AutoFitAll: Auto fit the size of all columns. AutoFit: Auto fit the current column. SortAscending: Sort the current column in ascending order. SortDescending: Sort the current column in descending order. Filter: Filter options will show based on filterSettings property like filterbar, menu filter.

    Remarks

    Actions for custom column menu items can be handled through 'Syncfusion.Blazor.TreeGrid.TreeGridEvents.ColumnMenuItemClicked' event.

    Examples
    <SfTreeGrid DataSource="@TreeGridData" ColumnMenuItems="@(new List<object>() { "AutoFit", "AutoFitAll", "SortAscending", "SortDescending" })" >
    </SfTreeGrid>

    ColumnQueryMode

    Defines how to the the column values of data source.

    Declaration
    public ColumnQueryModeType ColumnQueryMode { get; set; }
    Property Value
    Type Description
    ColumnQueryModeType

    One of the ColumnQueryModeType enumeration that specifies how the data source fields are retrieved. The default mode is Syncfusion.Blazor.Grids.ColumnQueryModeType.All.

    Remarks

    The types are, All: Retrieves whole data source with all columns. Schema: Retrieves data for only the defined TreeGridColumns from the data source. ExcludeHidden: Retrieves data only for Visible property enabled columns of tree grid from the data Source.

    Columns

    Gets or sets an instance of TreeGridColumn collection, which controls the rendering of column displayed in the tree grid content.

    Declaration
    public List<TreeGridColumn> Columns { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<TreeGridColumn>

    A List instance of TreeGridColumn.

    Remarks

    TreeGridColumn class provides various properties to customize tree grid columns.

    Examples
    <SfTreeGrid DataSource="@TreeGridData" >
    	<TreeGridColumns>
    		<TreeGridColumn Field="TaskName" HeaderText="Task Name" Width="50"></TreeGridColumn>
    	</TreeGridColumns>
    </SfTreeGrid>

    ContextMenuItems

    Gets or sets both built-in and custom context menu items. Built-in items are provided as instance List of object and custom context menu items are provided as List instance of 'Syncfusion.Blazor.Grids.ContextMenuItemModel'.

    Declaration
    public object ContextMenuItems { get; set; }
    Property Value
    Type Description
    System.Object

    The available built-in items are, AutoFitAll: Auto fit the size of all columns. AutoFit: Auto fit the current column. SortAscending: Sort the current column in ascending order. SortDescending: Sort the current column in descending order. Filter: Filter options will show based on filterSettings property like filterbar, menu filter. Copy: Copies the selected record values to clipboard. Edit: Edits current selected record. Save: Saves the edited record. Cancel: Cancels the edit operation. Delete: Removed the selected record. FirstPage: Moved to first page in pager enabled tree grid. PrevPage: Moved to first page in pager enabled tree grid. NexttPage: Moved to first page in pager enabled tree grid. LastPage: Moved to first page in pager enabled tree grid

    Remarks

    Actions for custom context menu items can be handled through 'Syncfusion.Blazor.TreeGrid.TreeGridEvents.ContextMenuItemClicked' event.

    Examples
    <SfTreeGrid DataSource="@TreeGridData" ContextMenuItems="@(new List<object>() { "AutoFit", "AutoFitAll", "SortAscending", "SortDescending", "Edit", "Delete", "Save", "Cancel" })">
    </SfTreeGrid>

    CopyHierarchyMode

    Defines how to copy the selected data in the tree grid rows.

    Declaration
    public CopyHierarchyType CopyHierarchyMode { get; set; }
    Property Value
    Type Description
    CopyHierarchyType

    One of the CopyHierarchyType enumeration that specifies how the data is copies to clipboard. The default mode is Syncfusion.Blazor.Grids.CopyHierarchyType.Parent.

    Remarks

    The available built-in items are, Parent: Copy the selected data with parent record. Child: Copy the selected data with child record. Both: Copy the selected data with both parent and child record. None: Copy only the selected record.

    DataSource

    Gets or sets the data source for rendering the tree grid rows. The data source value can be of any type that implements IEnumerable.

    Declaration
    public IEnumerable<TValue> DataSource { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<TValue>

    IEnumerable or List or ExpandoObject Ccllection or DynamicObject collection or Observable collection.

    Remarks

    To consume data from remote service or custom adaptor, SfDataManager component has to be used.

    Examples
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeGridData" >
    </SfTreeGrid>

    DataSourceChanged

    An event that is raised when the datasource changes.

    Declaration
    public EventCallback<IEnumerable<TValue>> DataSourceChanged { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<System.Collections.Generic.IEnumerable<TValue>>
    Remarks

    This event handler receives a object which provides the details of the datasource changed.

    Examples
    <SfTreeGrid>
    <TreeGridEvents DataSourceChanged="DataSourceChanged" TValue="BusinessObject"></TreeGridEvents>
    </SfTreeGrid>
    @code {
     public void DataSourceChanged(IEnumerable<BusinessObject> args)
     {
     }
    }

    EditSettings

    Gets or sets an instance of TreeGridEditSettings which configures the editing behavior of tree grid.

    Declaration
    public TreeGridEditSettings EditSettings { get; set; }
    Property Value
    Type Description
    TreeGridEditSettings

    An instance of TreeGridEditSettings.

    Remarks

    TreeGridEditSettings class provides various properties to customize editing operations.

    Examples
    <SfTreeGrid IdMapping="TaskId" AllowFiltering="true" ParentIdMapping="ParentId" DataSource="@TreeGridData" TreeColumnIndex="1" >
    	<TreeGridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Batch" NewRowPosition="RowPosition.Below">
    	</TreeGridEditSettings>
    </SfTreeGrid>

    EnableAdaptiveUI

    Gets or sets whether to enabled adaptive UI which makes tree grid adaptive to small screens. The Filtering and various actions in tree grid opens the UI for user in a pop-up occupying the entire screen.

    Declaration
    public bool EnableAdaptiveUI { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If adaptive UI is enabled to display pop-up, for filtering and various features, which occupies the entire screen. The default value is false.

    Remarks

    If adaptive UI is enabled to display pop-up, for filtering and various features, which occupies the entire screen. The default value is false.

    EnableAltRow

    Gets or sets whether to render alternate tree grid row elements with a CSS class.

    Declaration
    public bool EnableAltRow { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If enabled the tree grid will render with e-altrow CSS class to the alternative tr elements. The default value is false.

    EnableAutoFill

    Gets or sets whether to automatically fills a series of cells by dragging a cell right hand corner, as like in excel.

    Declaration
    public bool EnableAutoFill { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If enabled it allows to copy the data of the selected cells and paste it to another cells by just dragging the autofill icon of the selected cells up to the required cells.

    Remarks

    The value of selected cell is filled in other cells.

    EnableCollapseAll

    Gets or sets whether to load all the rows in collapsed state.

    Declaration
    public bool EnableCollapseAll { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to render all rows in collapsed state at initial rendering; otherwise, false.The default value is false.

    Remarks

    You can use Syncfusion.Blazor.TreeGrid.SfTreeGrid.CollapseAllAsync method for dynamic collapsing of all parent tasks.

    EnableColumnVirtualization

    Gets or sets whether to enable virtual loading of column cells.

    Declaration
    public bool EnableColumnVirtualization { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if need to enable column virtualization; otherwise, false. The default value is false.

    Remarks

    Loads large dataset of columns with better performance. Initially, renders only the columns that are in current viewport and load subsequent columns on horizontal scrolling.

    EnableHover

    Gets or sets whether to enable hovering effect on ree grid rows while mouse over it.

    Declaration
    public bool EnableHover { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to enable hovering effect; otherwise, false.The default value is false.

    Remarks

    While hovering on the row, the backgroud colour of row element changes.

    EnablePersistence

    Gets or sets whether to persist tree grid's current state during browser reload.

    Declaration
    public bool EnablePersistence { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if need to persist the state; otherwise, false. The default value is false.

    EnableRtl

    Gets or sets whether whether to render Tree Grid component in right to left direction.

    Declaration
    public bool EnableRtl { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if need to enable rendering component in right to left direction; otherwise, false. The default value is false.

    EnableVirtualization

    Gets or sets whether to enable virtual loading of rows.

    Declaration
    public bool EnableVirtualization { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if need to enable virtualization; otherwise, false.The default value is false.

    Remarks

    If 'EnableVirtualization' set to true, then the tree grid will render only the rows visible within the view-port and load subsequent rows on vertical scrolling. This helps to improve the performance of loading large dataset in tree grid.

    EnableVirtualMaskRow

    Gets or sets whether to display shimmer effect during scrolling action in virtual scrolling feature enabled tree grid. If disabled, spinner pop-up is display while virtual scrolling.

    Declaration
    public bool EnableVirtualMaskRow { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to enable shimmer effect; otherwise, false. The default value is false. 

    ExpandStateMapping

    Gets or sets the mapping field, in data object of data source, that denotes the expand status of parent row.

    Declaration
    public string ExpandStateMapping { get; set; }
    Property Value
    Type Description
    System.String

    Field name which maps the expand state of parent row.

    Remarks

    It renders parent row in expanded or collapsed state based on this mapping property value in data source.

    FilterSettings

    Gets or sets an instance of TreeGridFilterSettings which configures the filtering behavior of tree grid.

    Declaration
    public TreeGridFilterSettings FilterSettings { get; set; }
    Property Value
    Type Description
    TreeGridFilterSettings

    An instance of TreeGridFilterSettings.

    Remarks

    TreeGridFilterSettings class provides various properties to customize filtering operations.

    Examples
    <SfTreeGrid IdMapping="TaskId" AllowFiltering="true" FrozenColumns="2" ParentIdMapping="ParentId" DataSource="@TreeGridData" TreeColumnIndex="1">
        <TreeGridFilterSettings>
            <TreeGridFilterColumns>
            <TreeGridFilterColumn Field="TaskName" MatchCase="false" Operator="Syncfusion.Blazor.Operator.StartsWith" Predicate="and" Value="@Name"></TreeGridFilterColumn>
            </TreeGridFilterColumns>
        </TreeGridFilterSettings>
    </SfTreeGrid>

    FrozenColumns

    Gets or sets the number of frozen columns remains fixed in left side of tree grid.

    Declaration
    public int FrozenColumns { get; set; }
    Property Value
    Type Description
    System.Int32

    The number of non-scrolling columns. The default value is 0.

    FrozenRows

    Gets or sets the number of frozen rows remains fixed in top of tree grid.

    Declaration
    public int FrozenRows { get; set; }
    Property Value
    Type Description
    System.Int32

    The number of non-scrolling rows. The default value is 0.

    GridLines

    Defines how to show borders of row and cells in Tree Grid.

    Declaration
    public GridLine GridLines { get; set; }
    Property Value
    Type Description
    GridLine

    One of the GridLine enumeration that specifies whether to render horizontal and vertical border lines. The default value is yncfusion.Blazor.Grids.GridLine.Horizontal.

    Remarks

    The availble grid lines are,

    • BothDisplays both the horizontal and vertical grid lines.
    • NoneNo grid lines are displayed.
    • HorizontalDisplays the horizontal grid lines only.
    • VerticalDisplays grid lines based on the theme.

    HasChildMapping

    Gets or sets whether a record is parent or not for on-demand data loading in remote data binding.

    Declaration
    public string HasChildMapping { get; set; }
    Property Value
    Type Description
    System.String

    Field name in data object of data source which maps whether current record holds any child records. The default value is null.

    Height

    Gets or sets the height of the tree grid component container.

    Declaration
    public string Height { get; set; }
    Property Value
    Type Description
    System.String

    Pixel or percentage or auto, for example "500px". The default value is "auto".

    IdMapping

    Gets or sets the name of the field in the data object of data source, which contains the unique id of that row.

    Declaration
    public string IdMapping { get; set; }
    Property Value
    Type Description
    System.String

    This field name in the data object of data source.

    Remarks

    It is only applicable for self-referantial type data binding in tree grid.

    KeySettings

    Gets or sets an instance of TreeGridKeySettings to configure the hot keys of tree grid.

    Declaration
    public TreeGridKeySettings KeySettings { get; set; }
    Property Value
    Type Description
    TreeGridKeySettings

    An instance of TreeGridKeySettings

    Remarks

    TreeGridKeySettings class provides various properties to customize the hot keys.

    Examples
    <SfTreeGrid DataSource="TreeData" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update", "Search" })">
    	<TreeGridKeySettings MoveDownCell="Shift" ></TreeGridKeySettings>
    </SfTreeGrid>

    LoadChildOnDemand

    Gets or sets whether to load child record on demand in remote data binding. At initial rendering parent records are rendered in colllapsed state.

    Declaration
    public bool LoadChildOnDemand { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If need to load only parent records at initial load and child records are loaded on demand when expanding the parent row; otherwise, false.The default value is false.

    PageSettings

    Gets or sets an instance of TreeGridPageSettings which configures the paging beahvior in tree grid.

    Declaration
    public TreeGridPageSettings PageSettings { get; set; }
    Property Value
    Type Description
    TreeGridPageSettings

    An instance of TreeGridPageSettings.

    Remarks

    TreeGridPageSettings class provides various properties to customize paging operations.

    Examples
    <SfTreeGrid DataSource="@TreeGridData" AllowPaging="true">
        <TreeGridPageSettings PageSize="2" PageCount="10"></TreeGridPageSettings>
    </SfTreeGrid>

    ParentIdMapping

    Gets or sets the name of the field in data source, which contains unique id of parent record

    Declaration
    public string ParentIdMapping { get; set; }
    Property Value
    Type Description
    System.String

    Field name in data object of datasource which maps the parent record. The default value is null.

    Remarks

    It is only applicable for self-referantial type data binding in tree grid.

    PrintMode

    Defines PrintMode for printing the tree grid data.

    Declaration
    public PrintMode PrintMode { get; set; }
    Property Value
    Type Description
    PrintMode

    One of the PrintMode enumeration that specifies how to print the tree grid data. The default mode is yncfusion.Blazor.Grids.PrintMode.AllPages.

    Remarks

    The available print modes are as follows: AllPages: Prints all pages of the tree grid. CurrentPage: Prints the current page of the tree grid.

    Query

    Gets or sets an instance of Query which process the data based on query provided.

    Declaration
    public Query Query { get; set; }
    Property Value
    Type Description
    Query

    An instance of Query.

    Remarks

    Query class provides various options for doing data operations in tree grid.

    RowDropSettings

    Gets or sets an instance of TreeGridRowDropSettings which configures the row drop behavior of tree grid.

    Declaration
    public TreeGridRowDropSettings RowDropSettings { get; set; }
    Property Value
    Type Description
    TreeGridRowDropSettings

    An instance of TreeGridRowDropSettings.

    Remarks

    TreeGridRowDropSettings class provides various properties to customize row drop operations.

    Examples
    <SfTreeGrid DataSource="@TreeGridData" AllowRowDragAndDrop="true" AllowSelection="true" AllowPaging="true" TreeColumnIndex="1">
        <TreeGridRowDropSettings TargetID="Grid"></TreeGridRowDropSettings>
    </SfTreeGrid>

    RowHeight

    Gets or sets the height value for the tree grid rows.

    Declaration
    public double RowHeight { get; set; }
    Property Value
    Type Description
    System.Double

    Row height pixel value in integer. The default value is 36.

    SearchSettings

    Gets or sets an instance of TreeGridSearchSettings which configures the searching behavior of tree grid.

    Declaration
    public TreeGridSearchSettings SearchSettings { get; set; }
    Property Value
    Type Description
    TreeGridSearchSettings

    A List instance of TreeGridSearchSettings

    Remarks

    TreeGridSearchSettings class provides various properties to customize searching operations.

    Examples
    <SfTreeGrid DataSource="@TreeGridData" TreeColumnIndex="1" Toolbar="@(new List<string>() { "Search" })">
    	<TreeGridSearchSettings Key="Child Task 1"></TreeGridSearchSettings>
    </SfTreeGrid>

    SelectedRowIndex

    Gets or sets the selected row index in tree grid.

    Declaration
    public int SelectedRowIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    Row index of selected row, for example 3. The default value is -1.

    Remarks

    Allows you to select a row at initial rendering.

    SelectionSettings

    Gets or sets an instance of TreeGridSelectionSettings which configures the selection behavior of tree grid rows and cells.

    Declaration
    public TreeGridSelectionSettings SelectionSettings { get; set; }
    Property Value
    Type Description
    TreeGridSelectionSettings

    A List instance of TreeGridSelectionSettings

    Remarks

    TreeGridSelectionSettings class provides various properties to customize the row and cell selection.

    Examples
    <SfTreeGrid DataSource="@TreeGridData" AllowSelection="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update", "Search" })">
    	<TreeGridSelectionSettings Type="Syncfusion.Blazor.Grids.SelectionType.Multiple"></TreeGridSelectionSettings>
    </SfTreeGrid>

    ShowColumnChooser

    Gets or sets whether to render column chooser in Tree Grid.

    Declaration
    public bool ShowColumnChooser { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if need to enable the column chooser; otherwise, false.The default value is false.

    Remarks

    It allows you to dynamically show or hide columns.

    ShowColumnMenu

    Gets or sets whether to render the column menu option in each column with default items.

    Declaration
    public bool ShowColumnMenu { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if need to enable column menu; otherwise, false.The default value is true.

    Remarks

    If 'ShowColumnMenu' set to true, then it will enable all the build in column menu items. You can customize the column menu items using ColumnMenuItems.

    SortSettings

    Gets or sets an instance of TreeGridSortSettings which configures the sorting behavior of tree grid columns.

    Declaration
    public TreeGridSortSettings SortSettings { get; set; }
    Property Value
    Type Description
    TreeGridSortSettings

    A List instance of TreeGridSortSettings

    Remarks

    TreeGridSortSettings class provides various properties to sort the data in tree grid columns.

    Examples
    <SfTreeGrid DataSource="@TreeGridData" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update", "Search" })">
    	<TreeGridSortSettings>
    	<TreeGridSortColumns>
    	    <TreeGridSortColumn Field="TaskName" Direction="Syncfusion.Blazor.Grids.SortDirection.Descending"></TreeGridSortColumn>
    	</TreeGridSortColumns>
    	</TreeGridSortSettings>
    </SfTreeGrid>

    TextWrapSettings

    Gets or sets an instance of TreeGridTextWrapSettings which configures the wrapping behavior in tree grid cells.

    Declaration
    public TreeGridTextWrapSettings TextWrapSettings { get; set; }
    Property Value
    Type Description
    TreeGridTextWrapSettings

    A List instance of TreeGridTextWrapSettings

    Remarks

    TreeGridTextWrapSettings class provides various properties to wrap the content in the tree grid cells.

    Examples
    <SfTreeGrid DataSource="TreeData" AllowTextWrap="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update", "Search" })">
    	<TreeGridTextWrapSettings WrapMode="WrapMode.Content"></TreeGridTextWrapSettings>
    </SfTreeGrid>

    Toolbar

    Gets or sets both built-in and custom toolbar items. Built-in items are provided as instance List of string and custom toolbar items are provided as List instance of 'Syncfusion.Blazor.Navigations.ItemModel'.

    Declaration
    public object Toolbar { get; set; }
    Property Value
    Type Description
    System.Object

    The available built-in toolbar items are as follows: Add: Adds a new record. Edit: Edits the selected task. Update: Saves the edited task. Delete: Deletes the selected task. Cancel: Cancels the edit state. Search: Searches tasks by the given key. ExpandAll: Expands all the records of tree grid. CollapseAll: Collapses all the records of tree grid. Indent: Adds as a child to the previous record. Outdent: Removes as a child from the previos parent record. ExcelExport: Exports tree grid data in Excel format CsvExport: Exports tree grid data in CSV format.

    Remarks

    Both built-in and custom toolbar items can be added to toolbar.

    Examples
    <SfTreeGrid DataSource="TreeData" TreeColumnIndex="1" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update", "Search" })">
    </SfTreeGrid>

    TreeColumnIndex

    Gets or sets a column index that is used to expand or collapse its child rows.

    Declaration
    public int TreeColumnIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    Column index in integer. The default value is 0.

    UnmatchedAttributes

    Gets or sets custom atttribute to tree grid component root element

    Declaration
    public IDictionary<string, object> UnmatchedAttributes { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.IDictionary<System.String, System.Object>

    An instance of System.Collections.Generic.IDictionary<, >

    Remarks

    Any HTML attributes can be added to the root element of tree grid .

    Width

    Gets or sets the width of the tree grid component container.

    Declaration
    public string Width { get; set; }
    Property Value
    Type Description
    System.String

    Pixel or percentage or auto values. The default value is "auto".

    Methods

    AddRecordAsync()

    A new row with input fields is rendered in tree grid content, for user to fill the fields and then to save the new record. AllowAdding should be true.

    Declaration
    public Task AddRecordAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Examples
    <button id="AddRecord" @onclick="AddItem">AddItem</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    ........
    </SfTreeGrid>
    @code{
    SfTreeGrid<BusinessObject> TreeGrid;
    private async Task AddItem()
    {
    await TreeGrid.AddRecordAsync();
    }
    }

    AddRecordAsync(TValue, Nullable<Int32>, Nullable<RowPosition>)

    Inserts a new record into the tree grid at a particular row index and position. AllowAdding should be true.

    Declaration
    public Task AddRecordAsync(TValue data, Nullable<int> index = null, Nullable<RowPosition> position = null)
    Parameters
    Type Name Description
    TValue data

    The new record to be added.

    System.Nullable<System.Int32> index

    The index in which new record is to be added.

    System.Nullable<RowPosition> position

    The position such as Below, Above or Child, in which new record is to be added.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    When the index parameter is not passed, a new record is added at the top as the first row index.

    Examples
    <button id="AddRecord" @onclick="AddItem">AddRecord</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    ........
    </SfTreeGrid>
    @code{
    SfTreeGrid<BusinessObject> TreeGrid;
    private async Task AddItem()
    {
    var data = new BusinessObject() { TaskId = 21, TaskName = "Test Add", StartDate = new DateTime(2017, 10, 23), Duration = 10, Progress = 70, Priority = "Critical" };
    await TreeGrid.AddRecordAsync(data, 1, RowPosition.Below); // pass data,index and new row position here.
    }
    }

    AutoFitColumnsAsync(String[])

    Udpates the column width to fit its content automatically, ensuring that the width shows the content without wrapping/hiding.

    Declaration
    public Task AutoFitColumnsAsync(string[] fieldNames)
    Parameters
    Type Name Description
    System.String[] fieldNames

    The column names collection.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    You can use the method in the DataBound event to autofit the columns at initial rendering.

    Examples
    <button id="AutoFitColumns" @onclick="FitColumnshHandler">FitColumns</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task FitColumnshHandler()
       {
         await TreeGrid.AutoFitColumnsAsync(new List<string>() { "TaskName" , "Duration"}.ToArray()); // pass desire column field names
       }
    }

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder

    ClearFilteringAsync()

    Clears the filter from all columns in tree grid.

    Declaration
    public Task ClearFilteringAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    Clears the filtered rows of tree grid.

    Examples
    <button id="ClearFiltering" @onclick="ClearFilterHandler">ClearFiltering</button>
    <SfTreeGrid @ref="TreeGrid" AllowFiltering="true" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task ClearFilterHandler()
       {
         await TreeGrid.ClearFilteringAsync();
       }
    }

    ClearFilteringAsync(List<String>)

    Clears the filter from the columns in tree grid.

    Declaration
    public Task ClearFilteringAsync(List<string> fields)
    Parameters
    Type Name Description
    System.Collections.Generic.List<System.String> fields

    The field names from which filtering to be cleared.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    When a field name is not defined, it clears filtering from all the columns.

    Examples
    <button id="ClearFiltering" @onclick="ClearFilterHandler">ClearFiltering</button>
    <SfTreeGrid @ref="TreeGrid" AllowFiltering="true" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task ClearFilterHandler()
       {
         await TreeGrid.ClearFilteringAsync(new List<string>() { "TaskName" });
       }
    }

    ClearSelectionAsync()

    Deselects the current selected rows and cells.

    Declaration
    public Task ClearSelectionAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    Currently selected rows and cells in tree grid are cleared.

    Examples
    <button id="ClearSelection" @onclick="ClearSelectionHandler">ClearSelection</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task ClearSelectionHandler()
       {
         await TreeGrid.ClearSelectionAsync();
       }
    }

    ClearSortingAsync()

    Clears sorting from all the columns of tree grid.

    Declaration
    public Task ClearSortingAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Examples
    <button id="ClearSorting" @onclick="ClearSortingHandler">ClearSorting</button>
    <SfTreeGrid @ref="TreeGrid" AllowSorting="true" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task ClearSortingHandler()
       {
         await TreeGrid.ClearSortingAsync();
       }
    }

    CloseEditAsync()

    Cancels the active edit state in the tree grid.

    Declaration
    public Task CloseEditAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    Closes the add or edit form withou saving changes.

    Examples
    <button id="CloseEdit" @onclick="CloseEditHandler">CloseEdit</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    <TreeGridEditSettings AllowEditing="true" />
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task CloseEditHandler()
       {
         await TreeGrid.CloseEditAsync();
       }
    }

    CollapseAllAsync()

    Collapses all the parent rows.

    Declaration
    public Task CollapseAllAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Examples
    <button id="CollapseAll" @onclick="CollapseHandler">CollapseAll</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task CollapseHandler()
       {
         await TreeGrid.CollapseAllAsync();
       }
    }

    CollapseAtLevelAsync(Double)

    Collapses the records along with its child records, at specific hierarchical level.

    Declaration
    public Task CollapseAtLevelAsync(double level)
    Parameters
    Type Name Description
    System.Double level

    The level of the record until which the rows to be Collapsed.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    The root parent level is 0.

    Examples
    <button id="CollapseAtLevel" @onclick="CollapseHandler">CollapseAll</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task CollapseHandler()
       {
         await TreeGrid.CollapseAtLevelAsync(1);
       }
    }

    CollapseByKeyAsync(Object)

    Collapses a row based on the primary key value of the record.

    Declaration
    public Task CollapseByKeyAsync(object key)
    Parameters
    Type Name Description
    System.Object key

    The primary key value of the record to be collapsed.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    A primary key column must be specified using the IsPrimaryKey property.

    Examples
    <button id="collapseKey" @onclick="CollapseHandler">CollapseKey</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<HierarchyData> TreeGrid;
       private async Task CollapseHandler()
       {
           await TreeGrid.CollapseByKeyAsync(12); /// pass primary key value here
      }
    }

    CollapseRowAsync(TValue)

    Collapses the row based on the record given as parameter.

    Declaration
    public Task CollapseRowAsync(TValue record)
    Parameters
    Type Name Description
    TValue record

    The record to be collapsed.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Examples
    <button id="CollapseRow" @onclick="CollapseHandler">CollapseRow</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task CollapseHandler()
       {
         await TreeGrid.CollapseRowAsync(TreeGrid.GetCurrentViewRecords()[0]); // pass your desire record here to collapse the same.
       }
    }

    CopyAsync(Nullable<Boolean>)

    Copies the selected rows or cells data into clipboard.

    Declaration
    public Task CopyAsync(Nullable<bool> withHeader = null)
    Parameters
    Type Name Description
    System.Nullable<System.Boolean> withHeader

    Decides Whether to copy the record values along with header names.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    The behavior of copying the record can be modified using CopyHierarchyType enumeration property.

    Examples
    <button id="Copy" @onclick="CopyHandler">Copy</button>
    <SfTreeGrid @ref="TreeGrid" AllowSorting="true" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task CopyHandler()
       {
         await TreeGrid.CopyAsync(true);
       }
    }

    DeleteRecordAsync()

    Delete a record with Given options. If fieldname and data is not given then grid will delete the selected record. TreeGridEditSettings.AllowDeleting should be true.

    Declaration
    public Task DeleteRecordAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Examples
    <button id="DeleteRecord" @onclick="DeleteHandler">DeleteRecord</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     <TreeGridEditSettings AllowDeleting="true" />
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task DeleteHandler()
       {
    	await TreeGrid.DeleteRecordAsync(); // delete the selected record
       }
    }

    DeleteRecordAsync(String, TValue)

    Deletes a record from tree grid. AllowDeleting should be true.

    Declaration
    public Task DeleteRecordAsync(string fieldName, TValue data)
    Parameters
    Type Name Description
    System.String fieldName

    The field name of the primary key column.

    TValue data

    The record to be deleted.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    When the parameters are not passed, the selected record will be deleted.

    Examples
    <button id="DeleteRecord" @onclick="DeleteHandler">DeleteRecord</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     <TreeGridEditSettings AllowDeleting="true" />
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task DeleteHandler()
       {
    	await TreeGrid.DeleteRecordAsync("TaskId", TreeGrid.GetCurrentViewRecords()[0]);
       }
    }

    Dispose()

    Dispose unmanaged resources in the component.

    Declaration
    public override void Dispose()
    Overrides
    SfBaseComponent.Dispose()

    EditCellAsync(Int32, String)

    To edit any particular cell using row index and field name.

    Declaration
    public Task EditCellAsync(int rowIndex, string field)
    Parameters
    Type Name Description
    System.Int32 rowIndex

    The index of the row to be edited.

    System.String field

    The column name of the cell to be edited.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    AllowEditing should be true.

    Examples
    <button id="EditCell" @onclick="EditCell">EditHandler</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     <TreeGridEditSettings AllowEditing="true" />
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task EditHandler()
       {
    	await TreeGrid.EditCellAsync(1, "TaskName"); // pass rowIndex and fieldname.
       }
    }

    EnableToolbarItemsAsync(List<String>, Boolean)

    Enables or disables the toolBar items.

    Declaration
    public Task EnableToolbarItemsAsync(List<string> items, bool isEnable)
    Parameters
    Type Name Description
    System.Collections.Generic.List<System.String> items

    The toolbar items name collection.

    System.Boolean isEnable

    Decides whether the toolbar items should be enabled or disabled.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Examples
    <button id="EnableToolbarItems" @onclick="ToolbarHandler">EnableToolbarItems</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })">
     <TreeGridEditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true"  />
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task ToolbarHandler()
       {
    	await TreeGrid.EnableToolbarItemsAsync(new List<string>() { "Add" , "Edit"}, false); // here we disabled the Add and Edit toolbar items.
       }
    }

    EndEditAsync()

    Saves the modified values when the row or cell is in editing state.

    Declaration
    public Task EndEditAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    To close the edit state without saving changes, you can use CloseEditAsync() method.

    Examples
    <button id="EndEdit" @onclick="EditHandler">EndEdit</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData" >
     <TreeGridEditSettings AllowEditing="true" />
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task EditHandler()
       {
    	await TreeGrid.EndEditAsync();
       }
    }

    ExpandAllAsync()

    Expands all the parent rows of tree grid.

    Declaration
    public Task ExpandAllAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Examples
    <button id="ExpandAll" @onclick="ExpandHandler">ExpandAll</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task ExpandHandler()
         {
    		await TreeGrid.ExpandAllAsync();
         }

    ExpandAtLevelAsync(Double)

    Expands the records along with its parent at specific hierarchical level.

    Declaration
    public Task ExpandAtLevelAsync(double level)
    Parameters
    Type Name Description
    System.Double level

    The hierarchical level until which the rows to be Expanded.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    The root parent level is 0.

    Examples
    <button id=" ExpandAtLevel" @onclick="ExpandHandler"> ExpandAtLevel</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task ExpandHandler()
         {
    	await TreeGrid.ExpandAtLevelAsync(1); // pass the desire level here.
         }

    ExpandByKeyAsync(Object)

    Expands a row based on the primary key value of the corresponding record.

    Declaration
    public Task ExpandByKeyAsync(object key)
    Parameters
    Type Name Description
    System.Object key

    The primary key value of the record to be expanded.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    A primary key column must be specified using the IsPrimaryKey property.

    Examples
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    <button id="expandKey" @onclick="ExpandHandler">ExpandKey</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<HierarchyData> TreeGrid;
       private async Task ExpandHandler()
       {
            await TreeGrid.ExpandByKeyAsync(12); /// pass primary key value here.
       }
    }

    ExpandRowAsync(TValue)

    Expands the row based on the record given as a parameter.

    Declaration
    public Task ExpandRowAsync(TValue record)
    Parameters
    Type Name Description
    TValue record

    The record to be expanded.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Examples
    <button id="ExpandRow" @onclick="ExpandHandler">ExpandRow</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task ExpandHandler()
       {
         await TreeGrid.ExpandRowAsync(TreeGrid.GetCurrentViewRecords()[0]); // pass your desire record here to expand the same.
       }
    }

    ExportToCsvAsync(ExcelExportProperties, Nullable<Boolean>, Object, Nullable<Boolean>)

    Exports the Tree Grid data to CSV file.

    Declaration
    public Task ExportToCsvAsync(ExcelExportProperties excelExportProperties = null, Nullable<bool> isMultipleExport = null, object workbook = null, Nullable<bool> isBlob = null)
    Parameters
    Type Name Description
    ExcelExportProperties excelExportProperties

    Options for customizing the exporting document during export.

    System.Nullable<System.Boolean> isMultipleExport

    Decides whether whether multiple tree grid is exported to same file.

    System.Object workbook

    Workbook instance.

    System.Nullable<System.Boolean> isBlob

    Exports as blob instead of writing response.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    When the parameters were not passed, the tree grid data is exported without any customization. AllowExcelExport should be enabled.

    Examples
    <button id="ExportToCsv" @onclick="ExportHandler">ExportToCsv</button>
    <SfTreeGrid @ref="TreeGrid" AllowExcelExport="true" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task ExportHandler()
       {
           Syncfusion.Blazor.Grids.ExcelExportProperties ExportProperties = new Syncfusion.Blazor.Grids.ExcelExportProperties();
           ExportProperties.ExportType = Syncfusion.Blazor.Grids.ExportType.CurrentPage; // here we have changed the ExportType from AllPages to CurrentPage, as like same we can change our desire properties.
           await TreeGrid.ExportToCsvAsync(ExportProperties);
       }
    }

    ExportToExcelAsync()

    Exports the tree grid data to Excel file.

    Declaration
    public Task ExportToExcelAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    AllowExcelExport should be enabled.

    Examples
    <button id="ExportToExcel" @onclick="ExportHandler">ExportToExcel</button>
    <SfTreeGrid @ref="TreeGrid" AllowExcelExport="true" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task ExportHandler()
         {
            await TreeGrid.ExportToExcelAsync();
         }

    ExportToExcelAsync(ExcelExportProperties, Nullable<Boolean>, Object, Nullable<Boolean>)

    Exports the tree grid data to Excel file.

    Declaration
    public Task ExportToExcelAsync(ExcelExportProperties excelExportProperties = null, Nullable<bool> isMultipleExport = null, object workbook = null, Nullable<bool> isBlob = null)
    Parameters
    Type Name Description
    ExcelExportProperties excelExportProperties

    Options for customizing the excel document during export.

    System.Nullable<System.Boolean> isMultipleExport

    Decides whether whether multiple tree grid is exported to same file.

    System.Object workbook

    Workbook instance.

    System.Nullable<System.Boolean> isBlob

    Exports as blob instead of writing response.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    When the parameters were not passed, the tree grid data is exported without any customization. AllowExcelExport should be enabled.

    Examples
    <button id="ExportToExcel" @onclick="ExportHandler">ExportToExcel</button>
    <SfTreeGrid @ref="TreeGrid" AllowExcelExport="true" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task ExportHandler()
         {
           Syncfusion.Blazor.Grids.ExcelExportProperties ExportProperties = new Syncfusion.Blazor.Grids.ExcelExportProperties();
           ExportProperties.ExportType = Syncfusion.Blazor.Grids.ExportType.CurrentPage; // here we have changed the ExportType from AllPages to CurrentPage, as like same we can change our desire properties.
           await TreeGrid.ExportToExcelAsync(ExportProperties);
         }

    ExportToExcelAsync(TreeGridExcelExportProperties, Nullable<Boolean>, Object, Nullable<Boolean>)

    Exports the Tree Grid data to CSV file.

    Declaration
    public Task ExportToExcelAsync(TreeGridExcelExportProperties excelExportProperties = null, Nullable<bool> isMultipleExport = null, object workbook = null, Nullable<bool> isBlob = null)
    Parameters
    Type Name Description
    TreeGridExcelExportProperties excelExportProperties

    The properties of the exported excel document.

    System.Nullable<System.Boolean> isMultipleExport

    Decides whether whether multiple tree grid is exported to same file.

    System.Object workbook

    Workbook instance.

    System.Nullable<System.Boolean> isBlob

    Exports as blob instead of writing response.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    When the parameters were not passed, the tree grid data is exported without any customization. AllowExcelExport should be enabled.

    Examples
    <button id="ExportToExcel" @onclick="ExportHandler">ExportToExcel</button>
    <SfTreeGrid @ref="TreeGrid" AllowExcelExport="true" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task ExportHandler()
         {
    		Syncfusion.Blazor.TreeGrid.TreeGridExcelExportProperties ExportProperties = new Syncfusion.Blazor.TreeGrid.TreeGridExcelExportProperties();
    		ExportProperties.IsCollapsedStatePersist = true; // IsCollapsedStatePersist is set to true, to persist the collapsed state in exported document.
    		await TreeGrid.ExportToExcelAsync(ExportProperties);
         }

    ExportToPdfAsync()

    Exports the tree grid data to Pdf file.

    Declaration
    public Task ExportToPdfAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    AllowPdfExport should be enabled.

    Examples
    <button id="ExportToPdf" @onclick="ExportHandler">ExportToPdf</button>
    <SfTreeGrid @ref="TreeGrid" AllowPdfExport="true" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task ExportHandler()
       {
    	await TreeGrid.ExportToPdfAsync();
       }
    }

    ExportToPdfAsync(PdfExportProperties, Nullable<Boolean>, Object, Nullable<Boolean>)

    Exports the tree grid data to Pdf file.

    Declaration
    public Task ExportToPdfAsync(PdfExportProperties pdfExportProperties = null, Nullable<bool> isMultipleExport = null, object pdfDoc = null, Nullable<bool> isBlob = null)
    Parameters
    Type Name Description
    PdfExportProperties pdfExportProperties

    Options for customizing the pdf document during export.

    System.Nullable<System.Boolean> isMultipleExport

    Decides whether multiple tree grid is exported to same file.

    System.Object pdfDoc

    PDF document instance.

    System.Nullable<System.Boolean> isBlob

    Export as blob instead of writing response.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    When the parameters were not passed, the tree grid data is exported without any customization. AllowPdfExport should be enabled.

    Examples
    <button id="ExportToPdf" @onclick="ExportHandler">ExportToPdf</button>
    <SfTreeGrid @ref="TreeGrid" AllowPdfExport="true" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task ExportHandler()
       {
           Syncfusion.Blazor.Grids.PdfExportProperties ExportProperties = new Syncfusion.Blazor.Grids.PdfExportProperties();
           ExportProperties.ExportType = Syncfusion.Blazor.Grids.ExportType.CurrentPage; // here we have changed the ExportType from AllPages to CurrentPage, as like same we can change our desire properties.
           await TreeGrid.ExportToPdfAsync(ExportProperties);
       }
    }

    ExportToPdfAsync(TreeGridPdfExportProperties, Nullable<Boolean>, Object, Nullable<Boolean>)

    Exports the tree grid data to Pdf file.

    Declaration
    public Task ExportToPdfAsync(TreeGridPdfExportProperties pdfExportProperties = null, Nullable<bool> isMultipleExport = null, object pdfDoc = null, Nullable<bool> isBlob = null)
    Parameters
    Type Name Description
    TreeGridPdfExportProperties pdfExportProperties

    Options for customizing the pdf document during export.

    System.Nullable<System.Boolean> isMultipleExport

    Decides whether multiple tree grid is exported to same file.

    System.Object pdfDoc

    PDF document instance.

    System.Nullable<System.Boolean> isBlob

    Export as blob instead of writing response.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    When the parameters were not passed, the tree grid data is exported without any customization. AllowPdfExport should be enabled.

    Examples
    <button id="ExportToPdf" @onclick="ExportHandler">ExportToPdf</button>
    <SfTreeGrid @ref="TreeGrid" AllowPdfExport="true" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task ExportHandler()
       {
    	Syncfusion.Blazor.TreeGrid.TreeGridPdfExportProperties ExportProperties = new Syncfusion.Blazor.TreeGrid.TreeGridPdfExportProperties();
    	ExportProperties.IsCollapsedStatePersist = true; // IsCollapsedStatePersist is set to true, to persist the collapsed state in exported document.
    	await TreeGrid.ExportToPdfAsync(ExportProperties);
       }
    }

    FilterByColumnAsync(String, String, Object, String, Nullable<Boolean>, Nullable<Boolean>, String, String)

    Filters tree grid row with column details.

    Declaration
    public Task FilterByColumnAsync(string fieldName, string filterOperator, object filterValue, string predicate = null, Nullable<bool> matchCase = null, Nullable<bool> ignoreAccent = null, string actualFilterValue = null, string actualOperator = null)
    Parameters
    Type Name Description
    System.String fieldName

    The field name by which the data to be filtered.

    System.String filterOperator

    Operator in string

    System.Object filterValue

    The filter value.

    System.String predicate

    Predicate/condition such as AND/OR while filtering multiple value.

    System.Nullable<System.Boolean> matchCase

    Decieds whether case sensitive.

    System.Nullable<System.Boolean> ignoreAccent

    Decides whether to ignore accent.

    System.String actualFilterValue

    The actual value.

    System.String actualOperator

    The actual operator.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    AllowFiltering should be true.

    Examples
    <button id="FilterByColumn" @onclick="FilterHandler">FilterByColumn</button>
    <SfTreeGrid @ref="TreeGrid" AllowFiltering="true" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task FilterHandler()
         {
    	await TreeGrid.FilterByColumnAsync("TaskName", "equal", "Child task 1");
         }

    FocusAsync()

    Focuses the Tree Grid element in UI.

    Declaration
    public Task FocusAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    Helps in doing keyboard interactions by focusing the tree grid element.

    Examples
    <button id="Focus" @onclick="FocusHandler">Focus</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task FocusHandler()
       {
         await TreeGrid.FocusAsync();
       }
    }

    GetBatchChangesAsync()

    Returns the added, edited, and deleted data before bulk save to data source in batch edit mode of tree grid.

    Declaration
    public Task<BatchChanges<TValue>> GetBatchChangesAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<BatchChanges<TValue>>

    System.Threading.Tasks.Task.

    Remarks

    Helps to obtain the modified data in batch editing.

    Examples
    <button id="GetBatchChanges" @onclick="BatchHandler">GetBatchChanges</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    	<TreeGridEditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true" Mode="Syncfusion.Blazor.TreeGrid.EditMode.Batch" />
     ........
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task BatchHandler()
         {
    	var data = await TreeGrid.GetBatchChangesAsync();
         }

    GetCheckedRecordsAsync()

    Returns the records of checked checkbox column in UI.

    Declaration
    public Task<List<TValue>> GetCheckedRecordsAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<TValue>>

    System.Threading.Tasks.Task.

    Remarks

    Helps to obtain checked records from data source.

    Examples
    <button id="GetCheckedRecords" @onclick="CheckedRecordsHandler">GetCheckedRecords</button>
    <SfTreeGrid @ref="TreeGrid" AutoCheckHierarchy="true" DataSource="@TreeData">
      <TreeGridColumns>
          .................
            <TreeGridColumn Field="TaskName" ShowCheckbox="true" HeaderText="Task Name" Width="160"></TreeGridColumn>
          .............
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task CheckedRecordsHandler()
         {
              var data = await TreeGrid.GetCheckedRecordsAsync();
         }

    GetCheckedRowIndexes()

    Returns the row indexes of checked checkbox column.

    Declaration
    public Task<List<int>> GetCheckedRowIndexes()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<System.Int32>>

    System.Threading.Tasks.Task.

    Remarks

    Helps to obtain checked records from data source.

    Examples
    <button id="GetCheckedRowIndexes" @onclick="GetDataHandler">GetCheckedRowIndexes</button>
    <SfTreeGrid @ref="TreeGrid" AutoCheckHierarchy="true" DataSource="@TreeData">
      <TreeGridColumns>
          .................
            <TreeGridColumn Field="TaskName" ShowCheckbox="true" HeaderText="Task Name" Width="160"></TreeGridColumn>
          .............
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetDataHandler()
         {
    	var data = await TreeGrid.GetCheckedRowIndexes();
         }

    GetColumnByFieldAsync(String)

    Returns a TreeGridColumn object from the provided column name.

    Declaration
    public Task<TreeGridColumn> GetColumnByFieldAsync(string field)
    Parameters
    Type Name Description
    System.String field

    The field name of the column.

    Returns
    Type Description
    System.Threading.Tasks.Task<TreeGridColumn>

    System.Threading.Tasks.Task.

    Remarks

    Helps to read other column informations from the column name.

    Examples
    <button id="GetColumnByField" @onclick="GetColumnHandler">GetColumnByField</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
      <TreeGridColumns>
          .................
            <TreeGridColumn Field="TaskName" HeaderText="Task Name" Width="160"></TreeGridColumn>
          .............
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetColumnHandler()
         {
    	var column = await TreeGrid.GetColumnByFieldAsync("TaskName"); // pass field name here.
         }

    GetColumnByUidAsync(String)

    Returns a TreeGridColumn object from the provided column's unique id value .

    Declaration
    public Task<TreeGridColumn> GetColumnByUidAsync(string uid)
    Parameters
    Type Name Description
    System.String uid

    The unique id value.

    Returns
    Type Description
    System.Threading.Tasks.Task<TreeGridColumn>

    System.Threading.Tasks.Task.

    Remarks

    Helps to read other column informations from the column name.

    Examples
    <button id="GetColumnByUid" @onclick="GetColumnHandler">GetColumnByUid</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
      <TreeGridColumns>
          .................
            <TreeGridColumn Field="TaskName" Uid="task_name" HeaderText="Task Name" Width="160"></TreeGridColumn>
          .............
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetColumnHandler()
         {
    	var column = await TreeGrid.GetColumnByUidAsync("task_name"); // pass uid value here.
         }

    GetColumnFieldNamesAsync()

    Returns the collection of column names from tree grid.

    Declaration
    public Task<List<string>> GetColumnFieldNamesAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<System.String>>

    System.Threading.Tasks.Task.

    Examples
    <button id="GetColumnFieldNames" @onclick="GetColumnHandler">GetColumnFieldNames</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
      <TreeGridColumns>
          .................
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetColumnHandler()
         {
    	var columns = await TreeGrid.GetColumnFieldNamesAsync();
         }

    GetColumnIndexByFieldAsync(String)

    Returns then index of a particular column from the tree grid column collections.

    Declaration
    public Task<double> GetColumnIndexByFieldAsync(string field)
    Parameters
    Type Name Description
    System.String field

    The field name of the column.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Double>

    System.Threading.Tasks.Task.

    Examples
    <button id="GetColumnIndexByField" @onclick="GetColumnHandler">GetColumnIndexByField</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
      <TreeGridColumns>
          .................
            <TreeGridColumn Field="TaskName" HeaderText="Task Name" Width="160"></TreeGridColumn>
          .............
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetColumnHandler()
         {
    	var columnIndex = await TreeGrid.GetColumnIndexByFieldAsync("TaskName"); // pass field name here.
         }

    GetColumnIndexByUidAsync(String)

    Returns the index a particular column from the tree grid columns collection.

    Declaration
    public Task<double> GetColumnIndexByUidAsync(string uid)
    Parameters
    Type Name Description
    System.String uid

    The unique id value of the column.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Double>

    System.Threading.Tasks.Task.

    Examples
    <button id="GetColumnIndexByUid" @onclick="GetColumnHandler">GetColumnIndexByUid</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
      <TreeGridColumns>
          .................
            <TreeGridColumn Field="TaskName" Uid="task_name" HeaderText="Task Name" Width="160"></TreeGridColumn>
          .............
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetColumnHandler()
         {
    	var columnIndex = await TreeGrid.GetColumnIndexByUidAsync("task_name"); // pass uid value here.
         }

    GetColumnsAsync()

    Returns the columns collection of tree grid.

    Declaration
    public Task<List<TreeGridColumn>> GetColumnsAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<TreeGridColumn>>

    System.Threading.Tasks.Task.

    Examples
    <button id="GetColumns" @onclick="GetColumnHandler">GetColumns</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
      <TreeGridColumns>
          .................
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetColumnHandler()
         {
    	var columns = await TreeGrid.GetColumnsAsync();
         }

    GetCurrentViewRecords()

    Gets data object of data source which are in current view or page of tree grid.

    Declaration
    public List<TValue> GetCurrentViewRecords()
    Returns
    Type Description
    System.Collections.Generic.List<TValue>

    System.Threading.Tasks.Task.

    Remarks

    Returns current page records when paging or virual scrolling feature is enabled. Otherwise returns all records of data source.

    Examples
    <button id="GetCurrentViewRecords" @onclick="GetDataHandler">GetCurrentViewRecords</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
      <TreeGridColumns>
          .................
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private void GetDataHandler()
         {
    	var records = TreeGrid.GetCurrentViewRecords();
         }

    GetFilteredRecordsAsync()

    Returns all the filtered records from tree grid. It returns array of data objects for the local data source and returns a promise object if the tree grid has remote data binding.

    Declaration
    public Task<object> GetFilteredRecordsAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Object>

    System.Threading.Tasks.Task.

    Remarks

    Helps to obtain the filtered data when filtering is done in tree grid.

    Examples
    <button id="GetFilteredRecords" @onclick="FilterHandler"> GetFilteredRecords</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="TreeData" AllowFiltering="true" />
    …
    </SfTreeGrid>
    @code{
        SfTreeGrid<BusinessObject> TreeGrid;
        private async task  FilterHandler ()
        {
       var data = await TreeGrid.GetFileredRecordsAsync();
        }

    GetPersistDataAsync()

    Returns the serialized tree grid properties to be maintained in the persisted state.

    Declaration
    public Task<string> GetPersistDataAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    System.Threading.Tasks.Task.

    Remarks

    Users can use this method to later restore the tree grid state through SetPersistDataAsync(String) method.

    Examples
     
    <button id="GetPersistence" @onclick="GetPersistence">Get Persistence</button> 
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData"> 
     ........ 
    </SfTreeGrid> 
    @code{ 
       SfTreeGrid<BusinessObject> TreeGrid; 
       public string treegridstate;
       private async Task GetPersistence() 
       { 
         treegridstate = await TreeGrid.GetPersistDataAsync(); 
       } 
    } 

    GetPrimaryKeyFieldNamesAsync()

    Returns the names of the primary key columns in tree grid.

    Declaration
    public Task<List<string>> GetPrimaryKeyFieldNamesAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<System.String>>

    System.Threading.Tasks.Task.

    Examples
    <button id="GetPrimaryKeyFieldNames" @onclick="GetDataHandler">GetPrimaryKeyFieldNames</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
      <TreeGridColumns>
          .................
            <TreeGridColumn Field="TaskId" HeaderText="Task ID" IsPrimaryKey="true" Width="80" TextAlign="Syncfusion.Blazor.Grids.TextAlign.Right"></TreeGridColumn>
          .............
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetDataHandler()
         {
    	var primaryKeyFieldName = await TreeGrid.GetPrimaryKeyFieldNamesAsync();

    GetRowIndexByPrimaryKeyAsync(Object)

    Returns the row element index from the primary key value of corresponding data object in data source.

    Declaration
    public Task<double> GetRowIndexByPrimaryKeyAsync(object value)
    Parameters
    Type Name Description
    System.Object value

    Primary key value of a data object.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Double>

    System.Threading.Tasks.Task.

    Remarks

    A primary key column must be specified using the IsPrimaryKey property.

    Examples
    <button id="GetRowIndexByPrimaryKey" @onclick="GetDataHandler">GetSelectedRowIndexes</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetDataHandler()
         {
    	var rowIndex = await TreeGrid.GetRowIndexByPrimaryKeyAsync(1); // pass primary key value here.

    GetRowModel(TValue)

    Returns ITreeGridRowModel<TValue> which holds the information about level, expanded state, and etc. of the record.

    Declaration
    public ITreeGridRowModel<TValue> GetRowModel(TValue records)
    Parameters
    Type Name Description
    TValue records

    The record for which the hierarchy details are needed.

    Returns
    Type Description
    ITreeGridRowModel<TValue>

    Returns ITreeGridRowModel<TValue> which holds the hierarchy information of a record.

    Examples
     
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData"> 
    <TreeGridEvents TValue="TaskData" RowSelected="RowSelect"></TreeGridEvents>
    ........ 
    </SfTreeGrid> 
    @code{ 
    SfTreeGrid<BusinessObject> TreeGrid; 
    public void RowSelect(RowSelectEventArgs<TaskData> args)
    { 
        var treeItem = TreeGrid.GetRowModel(args.Data);
    } 
    } 

    GetSelectedRecordsAsync()

    Returns the collection of selected records.

    Declaration
    public Task<List<TValue>> GetSelectedRecordsAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<TValue>>

    System.Threading.Tasks.Task.

    Examples
    <button id="GetSelectedRecords" @onclick="GetDataHandler">GetSelectedRecords</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetDataHandler()
         {
    	var selectedRecords = await TreeGrid.GetSelectedRecordsAsync();

    GetSelectedRowCellIndexesAsync()

    Returns the collection of selected row and cell indexes.

    Declaration
    public Task<List<ValueTuple<int, int>>> GetSelectedRowCellIndexesAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<System.ValueTuple<System.Int32, System.Int32>>>

    System.Threading.Tasks.Task.

    Examples
    <button id="GetSelectedRowCellIndexes" @onclick="GetDataHandler">GetSelectedRowCellIndexes</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetDataHandler()
         {
    	var selectedRowcellIndexes = await TreeGrid.GetSelectedRowCellIndexesAsync();
         }
    }

    GetSelectedRowIndexesAsync()

    Returns the collection of selected row indexes.

    Declaration
    public Task<List<int>> GetSelectedRowIndexesAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<System.Int32>>

    System.Threading.Tasks.Task.

    Examples
    <button id="GetSelectedRowIndexes" @onclick="GetDataHandler">GetSelectedRowIndexes</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetDataHandler()
         {
    	var selectedRowIndexes = await TreeGrid.GetSelectedRowIndexesAsync();

    GetUidByColumnFieldAsync(String)

    Returns the unique id value of a tree grid column.

    Declaration
    public Task<string> GetUidByColumnFieldAsync(string field)
    Parameters
    Type Name Description
    System.String field

    The field name of the column.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    System.Threading.Tasks.Task.

    Examples
    <button id="GetUidByColumnField" @onclick="GetDataHandler">GetUidByColumnField</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
      <TreeGridColumns>
          .................
            <TreeGridColumn Field="TaskName" HeaderText="Task Name" Width="160"></TreeGridColumn>
          .............
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetDataHandler()
         {
    	var uid = await TreeGrid.GetUidByColumnFieldAsync("TaskName"); // pass field name here.
         }

    GetVisibleColumnsAsync()

    Returns the visible tree grid columns collection in UI.

    Declaration
    public Task<List<TreeGridColumn>> GetVisibleColumnsAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<TreeGridColumn>>

    System.Threading.Tasks.Task.

    Examples
    <button id="GetVisibleColumns" @onclick="GetColumnHandler">GetVisibleColumns</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task GetColumnHandler()
         {
    	var visibleColumns = await TreeGrid.GetVisibleColumnsAsync();
         }

    GoToPageAsync(Int32)

    Navigates to the specified target page.

    Declaration
    public Task GoToPageAsync(int pageNo)
    Parameters
    Type Name Description
    System.Int32 pageNo

    The page number you want to navigate.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    AllowPaging should be enabled.

    Examples
    <button id="GoToPage" @onclick="PagingHandler">GoToPage</button>
    <SfTreeGrid @ref="TreeGrid" AllowPaging="true" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task PagingHandler()
         {
    	await TreeGrid.GoToPageAsync(3); // pass desire page number here.
         }

    HideColumnAsync(String, String)

    Hides a particular tree grid column.

    Declaration
    public Task HideColumnAsync(string key, string hideBy = "HeaderText")
    Parameters
    Type Name Description
    System.String key

    The column name.

    System.String hideBy

    Whether the column name is based on Field or HeaderText property of column.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    You can dynamically hide a column. Based on the parameter hideBy, we can hide column using field or headerText value.

    Examples
    <button id="HideColumn" @onclick="ColumnHandler">HideColumn</button>
    <button id="HideColumnByField" @onclick="ColumnFieldHandler">HideColumnByField</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task ColumnHandler()
         {
    	await TreeGrid.HideColumnAsync("Task Name"); // pass headerText
         }
         private async Task ColumnFieldHandler()
         {
            await TreeGrid.HideColumnAsync("TaskName", "Field"); // pass second param as "Field" to hide using field name.
         }

    HideColumnsAsync(String[], String)

    Hides specified tree grid columns.

    Declaration
    public Task HideColumnsAsync(string[] keys, string hideBy = "HeaderText")
    Parameters
    Type Name Description
    System.String[] keys

    The column names.

    System.String hideBy

    Decides whether the column names are based on Field or HeaderText property of column.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    You can dynamically hide columns.

    Examples
    <button id="HideColumns" @onclick="ColumnHandler">HideColumns</button>
    <button id="HideColumnsByField" @onclick="ColumnFieldHandler">HideColumnsByField</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task ColumnHandler()
         {
            var columns = new List<string>() {"Task Name", "Duration" };
    		await TreeGrid.HideColumnsAsync(columns.ToArray());
         }
         private async Task ColumnFieldHandler()
         {
            var columns = new List<string>() {"TaskName", "Duration" };
            await TreeGrid.HideColumnsAsync(columns.ToArray(), "Field"); // pass second param as "Field" to hide using field name.
         }

    HideSpinnerAsync()

    Hides the spinner of tree grid whenever needed.

    Declaration
    public Task HideSpinnerAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    When the tree grid spinner is displayed manually, then you can manually hide the spinner using this method.

    Examples
    <button id="HideSpinner" @onclick="SpinnerHandler">HideSpinner</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task SpinnerHandler()
         {
    	await TreeGrid.HideSpinnerAsync(); // Hides the spinner.
         }

    OnAfterRenderAsync(Boolean)

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    System.Boolean firstRender
    Returns
    Type Description
    System.Threading.Tasks.Task
    Overrides
    SfDataBoundComponent.OnAfterRenderAsync(Boolean)

    OnInitializedAsync()

    Method invoked when the component is ready to start, having received its initial parameters from its parent in the render tree. Override this method if you will perform an asynchronous operation and want the component to refresh when that operation is completed.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing any asynchronous operation.

    Overrides
    SfDataBoundComponent.OnInitializedAsync()

    OnObservableChange(String, Object, Boolean, NotifyCollectionChangedEventArgs)

    Declaration
    protected override void OnObservableChange(string propertyName, object sender, bool isCollectionChanged = false, NotifyCollectionChangedEventArgs e = null)
    Parameters
    Type Name Description
    System.String propertyName
    System.Object sender
    System.Boolean isCollectionChanged
    System.Collections.Specialized.NotifyCollectionChangedEventArgs e
    Overrides
    SfBaseComponent.OnObservableChange(String, Object, Boolean, NotifyCollectionChangedEventArgs)

    OnParametersSetAsync()

    Method invoked when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties.

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing any asynchronous operation.

    Overrides
    SfDataBoundComponent.OnParametersSetAsync()

    OpenColumnChooserAsync(Nullable<Double>, Nullable<Double>)

    Opens the column chooser pop up on screen by given position(X and Y axis).

    Declaration
    public Task OpenColumnChooserAsync(Nullable<double> x = null, Nullable<double> y = null)
    Parameters
    Type Name Description
    System.Nullable<System.Double> x

    The X position in screen.

    System.Nullable<System.Double> y

    The Y position in screen.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    You can manually open the column chooser at any position of screen at any desired time.

    Examples
    <button id="OpenColumnChooser" @onclick="ColumnHandler">OpenColumnChooser</button>
    <SfTreeGrid @ref="TreeGrid" ShowColumnChooser="true" Toolbar="@(new List<string>() { "ColumnChooser" })" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task ColumnHandler()
         {
    	await TreeGrid.OpenColumnChooser(200, 50); // pass desire X and Y value.
         }

    PasteAsync(String, Double, Double)

    Fills a selected cell with a value.

    Declaration
    public Task PasteAsync(string data, double rowIndex, double colIndex)
    Parameters
    Type Name Description
    System.String data

    The value to be updated in a cell

    System.Double rowIndex

    Row index of the desired cell.

    System.Double colIndex

    Column index of the desired cell.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Examples
    <button id="Paste" @onclick="DataHandler">Paste</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task DataHandler()
         {
    	await TreeGrid.PasteAsync("test", 0, 4); // pass value, rowIndex and colIndex.
         }

    PreventRender(Boolean)

    Prevents the Tree Grid component re-render. This method will internally sets value to be returned from ShouldRender method.

    Declaration
    public void PreventRender(bool preventRender = true)
    Parameters
    Type Name Description
    System.Boolean preventRender

    Default value is true. Toggles the ShouldRender method value.

    PrintAsync()

    Prints the tree grid data directly from your browser.

    Declaration
    public Task PrintAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    You can customize print options using the PrintMode.

    Examples
    <button id="Print" @onclick="PrintHandler">Print</button>
    <SfTreeGrid @ref="TreeGrid" Toolbar="@(new List<string>() { "Print" })" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task PrintHandler()
         {
    	await TreeGrid.PrintAsync();
         }

    RefreshAsync()

    Refreshes the tree grid header and content.

    Declaration
    public Task RefreshAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    You can use this method whenever a manual refresh is needed to tree grid.

    Examples
    <button id="Refresh" @onclick="RefreshHandler">Refresh</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task RefreshHandler()
         {
    	await TreeGrid.RefreshAsync(); // refresh the tree grid.
         }

    RefreshColumnsAsync()

    Refreshes the tree grid with column changes, if any.

    Declaration
    public Task RefreshColumnsAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    You can use this method whenever TreeGridColumn object is modified externally.

    Examples
    <button id="RefreshColumns" @onclick="RefreshHandler">RefreshColumns</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task RefreshHandler()
         {
    	await TreeGrid.RefreshColumnsAsync(); // refresh the tree grid columns.
         }

    RefreshHeaderAsync()

    Refreshes the tree grid header.

    Declaration
    public Task RefreshHeaderAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    You can use this method whenever TreeGridColumn object is modified externally and need to refresh only the header element of tree grid.

    Examples
    <button id="RefreshHeader" @onclick="RefreshHandler">RefreshHeader</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task RefreshHandler()
         {
    	await TreeGrid.RefreshHeaderAsync(); // refresh the tree grid headers.
         }

    ReorderColumnsAsync(List<String>, String)

    Moves the columns position in UI from one column index to another.

    Declaration
    public Task ReorderColumnsAsync(List<string> fromFName, string toFName)
    Parameters
    Type Name Description
    System.Collections.Generic.List<System.String> fromFName

    The list of field names to be moved together.

    System.String toFName

    The field name of the destination column.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    AllowReordering should be enabled.

    Examples
    <button id="ReorderColumns" @onclick="ColumnHandler">ReorderColumns</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task ColumnHandler()
         {
    	await TreeGrid.ReorderColumnsAsync(new List<string>(){"TaskName", "Duration"}, "Progress");
         }

    ReorderRowAsync(Int32, Int32, String)

    Moves a row position in UI from one row index to another.

    Declaration
    public Task ReorderRowAsync(int fromIndex, int toIndex, string position = null)
    Parameters
    Type Name Description
    System.Int32 fromIndex

    The row index from which the row needs to be moved.

    System.Int32 toIndex

    Th row index to which the row needs to be moved..

    System.String position

    One of the string values of RowPosition that decides whether to move the row as above or below or child to destination row index

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    AllowRowDragAndDrop should be enabled.

    Examples
    <button id="ReorderRow" @onclick="RowHandler">ReorderRow</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task RowHandler()
         {
    	await TreeGrid.ReorderRowAsync(6, 5, "Child");
         }

    ResetPersistDataAsync()

    Resets the current state and refreshes the tree grid with original state given declaratively.

    Declaration
    public Task ResetPersistDataAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    Applicable when State Persistence feature is enabled in tree grid.

    Examples
     
    <button id="ClearPersistence" @onclick="ClearPersistence">Clear Persistence</button> 
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData"> 
     ........ 
    </SfTreeGrid> 
    @code{ 
       SfTreeGrid<BusinessObject> TreeGrid; 
       private async Task ClearPersistence() 
       { 
         await TreeGrid.ResetPersistDataAsync(); 
       } 
    } 

    SaveCellAsync()

    Saves the cell value that is currently edited.

    Declaration
    public Task SaveCellAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Examples
    <button id="SaveCell" @onclick="CellHandler">SaveCell</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     <TreeGridEditSettings AllowEditing="true" Mode="Syncfusion.Blazor.TreeGrid.EditMode.Batch"/>
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task CellHandler()
       {
    	await TreeGrid.SaveCellAsync();
       }
    }

    SearchAsync(String)

    Searches the tree grid records using the given key.

    Declaration
    public Task SearchAsync(string searchString)
    Parameters
    Type Name Description
    System.String searchString

    The search key.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    Searches the given key and displays only the rows which matches the key with any of its column values.

    Examples
    <button id="Search" @onclick="DataHandler">Search</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task DataHandler()
       {
    	await TreeGrid.SearchAsync("Child task 1");
       }
    }

    SelectCellAsync(ValueTuple<Int32, Int32>, Nullable<Boolean>)

    Selects a cell by the given index.

    Declaration
    public Task SelectCellAsync(ValueTuple<int, int> cellIndex, Nullable<bool> isToggle = null)
    Parameters
    Type Name Description
    System.ValueTuple<System.Int32, System.Int32> cellIndex

    The ValueTuple of row and cell index. Example: (0, 1).

    System.Nullable<System.Boolean> isToggle

    Toggles the selection.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    AllowSelection should be enabled.

    Examples
    <button id="SelectCell" @onclick="CellHandler">SelectCell</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    <TreeGridSelectionSettings Type="SelectionType.Multiple" Mode="Syncfusion.Blazor.Grids.SelectionMode.Cell" ></TreeGridSelectionSettings>
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task CellHandler()
       {
    	await TreeGrid.SelectCellAsync((1,1)); // pass row and cell index
       }
    }

    SelectCheckboxesAsync(Double[])

    Checks the column checkboxes using row indexes.

    Declaration
    public Task SelectCheckboxesAsync(double[] rowIndexes)
    Parameters
    Type Name Description
    System.Double[] rowIndexes

    The row indexes in which the checkbox to be checked.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    ShowCheckbox should be enabled.

    Examples
    <button id="SelectCheckboxes" @onclick="CheckboxHandler">SelectCheckboxes</button>
    <SfTreeGrid @ref="TreeGrid" AutoCheckHierarchy="true" DataSource="@TreeData">
      <TreeGridColumns>
          .................
            <TreeGridColumn Field="TaskName" ShowCheckbox="true" HeaderText="Task Name" Width="160"></TreeGridColumn>
          .............
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task CellHandler()
         {
            var indexes = new List<double>(){5, 6};
        await TreeGrid.SelectCheckboxesAsync(indexes.ToArray());
         }

    SelectRowAsync(Int32, Nullable<Boolean>)

    Selects a row by given index.

    Declaration
    public Task SelectRowAsync(int index, Nullable<bool> isToggle = null)
    Parameters
    Type Name Description
    System.Int32 index

    The row index to be selected.

    System.Nullable<System.Boolean> isToggle

    Toggles the selection.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    AllowSelection should be enabled.

    Examples
    <button id="SelectRow" @onclick="RowHandler">SelectRow</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
      <TreeGridColumns>
          .............
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task RowHandler()
         {
    	await TreeGrid.SelectRowAsync(2);
         }

    SelectRowsAsync(Int32[])

    Selects a collection of rows by indexes.

    Declaration
    public Task SelectRowsAsync(int[] rowIndexes)
    Parameters
    Type Name Description
    System.Int32[] rowIndexes

    The indexes of rows to be selected.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    AllowSelection should be enabled.

    Examples
    <button id="SelectRow" @onclick="RowHandler">SelectRow</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
      <TreeGridColumns>
          .............
      </TreeGridColumns>
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task RowHandler()
         {
            var indexes = new List<double>(){2, 3};
        await TreeGrid.SelectRowsAsync(indexes.ToArray());
         }

    SetCellValueAsync(Object, String, Object)

    Updates particular cell value based on the given primary key value.

    Declaration
    public Task SetCellValueAsync(object key, string field, object value)
    Parameters
    Type Name Description
    System.Object key

    The primary key value of a record.

    System.String field

    The column or field name.

    System.Object value

    The new value.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    Mode should be Cell or Batch. A primary key column must be specified using the IsPrimaryKey property.

    Examples
    <button id="SetCellValue" @onclick="CellHandler">SetCellValue</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
     <TreeGridEditSettings AllowEditing="true" Mode="Syncfusion.Blazor.TreeGrid.EditMode.Cell"/>
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task CellHandler()
       {
    	await TreeGrid.SetCellValueAsync(2, "TaskName", "test");
       }
    }

    SetIndentRecordAsync(TValue)

    Indent the selected or specified record based on its level.

    Declaration
    public Task SetIndentRecordAsync(TValue data)
    Parameters
    Type Name Description
    TValue data

    Specify the record which needs to be indented.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    SetOutdentRecordAsync(TValue, Boolean)

    Outdent the selected or specified record based on its level.

    Declaration
    public Task SetOutdentRecordAsync(TValue data, bool IsUpdateSiblingRows = false)
    Parameters
    Type Name Description
    TValue data

    Specify the record which needs to be outdented.

    System.Boolean IsUpdateSiblingRows

    Optional boolean value, which specify whether to indent the sibling record as child to selected record.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    SetPersistDataAsync(String)

    Loads a already saved state of tree grid.

    Declaration
    public Task SetPersistDataAsync(string properties)
    Parameters
    Type Name Description
    System.String properties

    Serialized tree grid properties to apply to current state.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    Users can view pre stored state easily in tree grid. Current state can be stored using SetPersistDataAsync(String) method.

    Examples
     
    <button id="SetPersistence" @onclick="SetPersistence">Set Persistence</button> 
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData"> 
     ........ 
    </SfTreeGrid> 
    @code{ 
       SfTreeGrid<BusinessObject> TreeGrid; 
       public string treegridstate;
       private async Task SetPersistence() 
       { 
         await TreeGrid.SetPersistDataAsync(treegridstate); 
       } 
    } 

    SetRowDataAsync(Object, TValue)

    Updates the particular row values based on the given primary key value.

    Declaration
    public Task SetRowDataAsync(object primaryKey, TValue rowData)
    Parameters
    Type Name Description
    System.Object primaryKey

    The PrimaryKey value of a record object in data source.

    TValue rowData

    New data for the particular row.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    AllowEditing should be enabled.

    Examples
    <button id="SetRowData" @onclick="DataHandler">SetRowData</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    <TreeGridEditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true" Mode="Syncfusion.Blazor.TreeGrid.EditMode.Row" />
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task DataHandler()
       {
         var data = new BusinessObject() { TaskId=2, TaskName = "Test Add", StartDate = new DateTime(2017, 10, 23), Duration = 10, Progress = 70, Priority = "Critical" };
         await TreeGrid.SetRowDataAsync(2, data);
       }
    }

    ShouldRender()

    Declaration
    protected override bool ShouldRender()
    Returns
    Type Description
    System.Boolean

    ShowColumnAsync(String, String)

    Shows a particular tree grid column.

    Declaration
    public Task ShowColumnAsync(string key, string showBy = "HeaderText")
    Parameters
    Type Name Description
    System.String key

    The column name.

    System.String showBy

    Decides whether the column name is based on Field or HeaderText property of column.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    You can dynamically show a hidden column.

    Examples
    <button id="ShowColumn" @onclick="ColumnHandler">ShowColumn</button>
    <button id="ShowColumnByField" @onclick="ColumnFieldHandler">ShowColumnByField</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task ColumnHandler()
         {
    		await TreeGrid.ShowColumnAsync("Task Name"); // pass headerText
         }
         private async Task ColumnFieldHandler()
         {
            await TreeGrid.ShowColumnAsync("TaskName", "Field"); // pass second param as "Field" to hide using field name.
         }

    ShowColumnsAsync(String[], String)

    Shows specified tree grid columns.

    Declaration
    public Task ShowColumnsAsync(string[] keys, string showBy = "HeaderText")
    Parameters
    Type Name Description
    System.String[] keys

    The column names.

    System.String showBy

    Whether the column names are based on Field or HeaderText property of column.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    You can dynamically show hidden columns.

    Examples
    <button id="ShowColumns" @onclick="ColumnHandler">ShowColumns</button>
    <button id="ShowColumnsByField" @onclick="ColumnFieldHandler">ShowColumnsByField</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task ColumnHandler()
         {
            var columns = new List<string>() {"Task Name", "Duration" };
    		await TreeGrid.ShowColumnsAsync(columns.ToArray());
         }
         private async Task ColumnFieldHandler()
         {
            var columns = new List<string>() {"TaskName", "Duration" };
            await TreeGrid.ShowColumnsAsync(columns.ToArray(), "Field"); // pass second param as "Field" to hide using field name.
         }

    ShowSpinnerAsync()

    Shows the spinner in tree grid whenever needed to indicate that a tree grid action is in processing.

    Declaration
    public Task ShowSpinnerAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Examples
    <button id="ShowSpinner" @onclick="SpinnerHandler">ShowSpinner</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task SpinnerHandler()
         {
    	await TreeGrid.ShowSpinnerAsync(); // shows the spinner.
         }

    SortByColumnAsync(String, SortDirection, Nullable<Boolean>)

    Sorts a column with the column details.

    Declaration
    public Task SortByColumnAsync(string columnName, SortDirection direction, Nullable<bool> isMultiSort = null)
    Parameters
    Type Name Description
    System.String columnName

    The field name to be sorted.

    SortDirection direction

    One of the values of SortDirection.

    System.Nullable<System.Boolean> isMultiSort

    Decides whether to do multi-sorting.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    AllowSorting should be true.

    Examples
    <button id="SortByColumn"  @onclick="SortHandler">SortByColumn</button>
    <SfTreeGrid @ref="TreeGrid" AllowSorting="true" DataSource="@TreeData">
          .................
    </SfTreeGrid>
    @code{
         SfTreeGrid<BusinessObject> TreeGrid;
         private async Task SortHandler()
         {
    	await TreeGrid.SortByColumn("TaskName", SortDirection.Descending);
         }

    StartEditAsync()

    Renders edit form to edit the selected row.

    Declaration
    public Task StartEditAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    A row must be selected beffore calling this method.

    Examples
    <button id="StartEdit" @onclick="DataHandler">StartEdit</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    <TreeGridEditSettings AllowEditing="true" />
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task DataHandler()
       {
         await TreeGrid.StartEditAsync();
       }
    }

    UpdateCellAsync(Int32, String, Object)

    Update the specified cell with given value.

    Declaration
    public Task UpdateCellAsync(int rowIndex, string field, object value)
    Parameters
    Type Name Description
    System.Int32 rowIndex

    The row index of the desired cell.

    System.String field

    The column name of the desired cell.

    System.Object value

    The new value.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    Mode should be Cell or Batch. And AllowEditing should be enabled.

    Examples
    <button id="UpdateCell" @onclick="DataHandler">UpdateCell</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    <TreeGridEditSettings AllowEditing="true" Mode="Syncfusion.Blazor.TreeGrid.EditMode.Cell" />
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task DataHandler()
       {
         await TreeGrid.UpdateCellAsync(1, 'TaskName', 'test');
       }
    }

    UpdateExternalMessageAsync(String)

    Defines the text of external message.

    Declaration
    public Task UpdateExternalMessageAsync(string message)
    Parameters
    Type Name Description
    System.String message

    Specifies the externam message.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    UpdateRowAsync(Int32, TValue)

    Updates the specified row with given values.

    Declaration
    public Task UpdateRowAsync(int index, TValue data)
    Parameters
    Type Name Description
    System.Int32 index

    The row index of the desired row.

    TValue data

    The new data to be updated.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    Remarks

    AllowEditing should be enabled.

    Examples
    <button id="UpdateRow" @onclick="DataHandler">UpdateRow</button>
    <SfTreeGrid @ref="TreeGrid" DataSource="@TreeData">
    <TreeGridEditSettings AllowEditing="true" Mode="Syncfusion.Blazor.TreeGrid.EditMode.Batch" />
     ........
    </SfTreeGrid>
    @code{
       SfTreeGrid<BusinessObject> TreeGrid;
       private async Task DataHandler()
       {
         var data = TreeGrid.GetCurrentViewRecords()[6];
         data.TaskName = "test";
         data.Duration = 80;
         await TreeGrid.UpdateRowAsync(6, data);
       }
    }
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved